Skip to main content

Checkout

Our Checkout-as-a-Service offers a JavaScript solution that seamlessly integrates into your environment as an embedded payment form.

Alternatively, leverage our Redirect Checkout method to utilize it within our hosted environment.

This approaches are ideal for those preferring not to engage with our server-to-server API.

We are committed to continuous enhancements of our checkout system, ensuring an improved customer experience and a boost in your sales conversions.

Payment Methods, Countries and Payment Currencies

In order to request a payment on our API it is necessary to include the Payment Country and Payment Currency. For each payment methods we offer these are the supported country/currency pairs.

BrazilMexicoColombiaCosta RicaEcuadorGuatemalaPanamaPeruChileHondurasDominican Republic
Credit CardBR/BRL
Debit CardBR/BRL
PIXBR/BRL
BoletoBR/BRL
PicPayBR/BRL
OXXOMX/MXN
PaynetMX/MXN
SPEIMX/MXN
PaycashMX/MXNCO/COPCR/CRCEC/USDGT/GTQPA/USDPE/PENCL/CLPHN/HNLDO/DOP

Flows

Credit Card with process payment option = true (default)

  1. Initiate Checkout solution using Credit Card as payment method
  2. User informs Personal information and Credit Card data
  3. Data is encrypted
  4. Payment is processed

Credit Card numbers for testing purposes - Brazil

TypeNumberValid ThroughCVV
MastercardCredit Card524008297562245412/2026123
VisaCredit Card453962065992209712/2026123
AmexCredit Card34581769031136112/2026123
HiperCredit Card606282859891902112/2026123
EloCredit Card451416112211375712/2026123
Visa3DS400000000000250312/2026123
Mastercard3DS520000000000109612/2026123
Elo3DS650505000000109112/2026123

Credit Card with process payment option = false

In this flow our checkout can serve as a tokenization tool. After the user provides the card data the card is encrypted, tokenized and the merchant receives an ID

  1. Initiate Checkout solution using Credit Card as payment method
  • Flag processPayment = false
  1. User informs Personal information and Credit Card data
  2. Data is encrypted
  3. Retrieve Credit Card payment token
  4. Authenticate on API
  5. Request Tokenized Credit Card Ids
  6. Process Payment

Boleto

  1. Initiate Checkout solution using BOLETO as payment method
  2. User informs Personal information
  3. Boleto is presented to the user
  4. Retrieve payment token

PIX

  1. Initiate Checkout solution using PIX as payment method
  2. Pix code is presented to the user
  • There is an option to have the user to input data before showing the QR code using the pixDirect option as false
  1. Retrieve payment token

PicPay

  1. Initiate Checkout solution using PICPAY as payment method
  2. PicPay QR Code is presented to the user
  3. Retrieve payment token

OXXO (Mexico)

  1. Initiate Checkout solution using OXXO as payment method
  2. User informs Personal information
  3. OXXO barcode is presented to the user
  4. Retrieve payment token

Paynet (Mexico)

  1. Initiate Checkout solution using PAYNET as payment method
  2. User informs Personal information
  3. Paynet barcode is presented to the user
  4. Retrieve payment token

SPEI (Mexico)

  1. Initiate Checkout solution using SPEI as payment method
  2. User informs Personal information
  3. SPEI CLABE is presented to the user
  4. Retrieve payment token

Frontend

Include our javascript library in the section of your HTML

JSON
   <script src="https://checkout-sandbox.letpay.io/checkout-v0.1.js"></script>

Initiate the solution using HTML markup or Javascript:

Method I: HTML

Mount the checkout and display the pay button. Click on it to lauch the lightbox.

html
  <body>
<letpay-checkout amount="137.76" asset="BRL" reference-id="MY_REFERENCE_ID" contract-id="MY_CONTRACT_ID" method="CREDITCARD">
</letpay-checkout>
</body>

Method II: Javascript

Option1: Mount the checkout and display the pay button in the specific element. Click on it to launch the lightbox.

javascript
    const letpayCheckout = new letpayCheckout({
amount: 137.76,
asset: "BRL",
referenceId: "MY_REFERENCE_ID",
contractId: "MY_CONTRACT_ID",
method: "CREDITCARD",
});
letpayCheckout.mountIn('#checkout-container-element');

Option 2: Mount the checkout and launch immediately the lightbox. With this method the pay button will not get visible.

javascript
    const letpayCheckout = new letpayCheckout({
amount: 137.76,
asset: "BRL",
referenceId: "MY_REFERENCE_ID",
contractId: "MY_CONTRACT_ID",
method: "CREDITCARD",
});
letpayCheckout.start();

Configuration Options

Required

HTML attributeJS PropTypeDefaultDescription
assetassetstringn/aReference code for asset for the sale's amount
reference-idreferenceIdstringn/aExternal code created by merchant to reference the payment
contract-idcontractIdstringn/aletpay's contract_id to be used in this sale
amountamountnumbern/aTotal amount of the payment. Value must have a maximum of two decimal places and must not be less than BRL 0.75
payment-countrypaymentCountrystringBRCountry code in ISO 3166-2 for the payment
payment-currencypaymentCurrencystringBRLCurrency code in ISO-4217 for the payment

Payment

HTML AttributeJS PropTypeRequiredDefaultDescription
methodmethodstringyesn/aPayment Method. Valid options: CREDITCARD, DEBITCARD, PIX, BOLETO, PICPAY, OXXO, PAYNET, SPEI, PAYCASH.
card-installmentscardInstallmentsnumberno1Number of installments. Used if method is CREDITCARD.
soft-descriptorsoftDescriptorstringnon/aSoft descriptor to use at card transaction.
process-paymentprocessPaymentbooleannofalseAutomatically process the payment (CREDITCARD, DEBITCARD only).
delay-capturedelayCapturebooleannofalsePre-authorizes the payment for later capture (CREDITCARD, PICPAY only).
save-cardsaveCardbooleannotrueTokenizes card for future uses. Works only if processPayment = true, otherwise saveCard will always be true.
pix-directpixDirectbooleannofalsetrue will show the QR code for PIX payment without collecting payer data. Merchants can still send data to be linked to the transaction.
boleto-expiration-dateboletoExpirationDateYYYY-MM-DDno5 days from nowExpiration date (defaults to five days from current date if not provided).
boleto-line1boletoLine1stringnon/aFirst instruction line for cashier and customer.
boleto-line2boletoLine2stringnon/aSecond instruction line for cashier and customer.
boleto-line3boletoLine3stringnon/aThird instruction line for cashier and customer.
notification-urlnotificationUrlstringnon/aURL to notify when transaction is successful.
support-textsupportTextstringnon/aFooter text in customer email for support contact (e.g., "Questions? Email [email protected]").
return-urlreturnUrlstringnon/aURL to redirect the customer when checkout is finished.
lightbox-use-3dslightboxUse3dsbooleannofalseEnables 3DS authentication if true.
lightbox-use-external-3dslightboxUseExternal3dsbooleannofalseEnables 3DS authentication with an external MPI if true.

Customer Details

HTML AttributeJS PropTypeRequiredDefaultDescription
address-additionaladdressAdditionalstringnon/aAdditional information for this address (e.g. department).
address-cityaddressCitystringnon/aBilling address city.
address-countryaddressCountrystringnon/aCountry code as ISO 3166-1 alpha-2 code.
address-localityaddressLocalitystringnon/aBilling address locality (e.g. neighborhood).
address-mainaddressMainstringnon/aMain information of the address (e.g. street or avenue).
address-numberaddressNumbernumbernon/aNumber for this address.
address-stateaddressStatestringnon/aBilling address state code.
address-zip-codeaddressZipCodestringnon/aBilling address zip code.
person-birthpersonBirthYYYY-MM-DDnon/aDate of birth.
person-emailpersonEmailstringnon/aPerson's email provided to the merchant.
person-first-namepersonFirstNamestringnon/aFirst name of this person. Min 3 characters for OXXO, SPEI, and PAYNET methods.
person-phonepersonPhonestringnon/aBilling address telephone.
person-phone-areapersonPhoneAreanumber (max 2 digits)non/aNumber of phone area code.
person-phone-countrypersonPhoneCountrynumber (max 2 digits)non/aNumber of country phone code.
person-surnamepersonSurnamestringnon/aSurname of this person.
person-tax-idpersonTaxIdstringnon/aUnique identifier for this person in country tax system (e.g. in Brazil: CPF).
disable-dobdisableDobbooleannotrueHides the date of birth.
lock-emaillockEmailbooleannofalsePrevents editing the person's email.

Widget options

HTML AttributeJS PropTypeRequiredDefaultDescription
button-labelbuttonLabelstringnoPay nowString that defines the widget button text.
button-colorbuttonColorvalid CSS colorno#3375C9Valid CSS color for the button.
button-text-colorbuttonTextColorvalid CSS colorno#FFFFFFValid CSS color for the button text.
HTML AttributeJS PropTypeRequiredDefaultDescription
lightbox-logo-urllightboxLogoUrlstringnoletpay logoThe URL of your logo (180 x 30 pixels) beginning with https.
lightbox-primary-colorlightboxPrimaryColorvalid CSS colorno#303740Color applied to header.
lightbox-secondary-colorlightboxSecondaryColorvalid CSS colorno#314259Color applied to action buttons.
lightbox-accent-colorlightboxAccentColorvalid CSS colorno#027BE3Color applied to input focus and active stepper.
lightbox-positive-colorlightboxPositiveColorvalid CSS colorno#A5DC86Color applied to success icon and success messages.
lightbox-negative-colorlightboxNegativeColorvalid CSS colorno#F27474Color applied to error icon and error messages.
lightbox-info-colorlightboxInfoColorvalid CSS colorno#F8BB86Color applied to loader icon and info messages.
lightbox-warning-colorlightboxWarningColorvalid CSS colorno#F2C037Color applied to warning icon and warning messages.
lightbox-address-bar-colorlightboxAddressBarColorvalid CSS colorno#292F36Color applied to address bar when in mobile.
lightbox-complete-purchase-button-labellightboxCompletePurchaseButtonLabelstringnoConcluir compraString that defines the button's complete purchase text in boleto success feedback page.
lightbox-disable-addresslightboxDisableAddressbooleannofalseIf true, disables the user's address collection step.
lightbox-partial-addresslightboxPartialAddressbooleannofalseIf true, requires only the user's zip code and number.

Events

Event NameWhen
checkout-successEvent emitted when successfully processed the payment.
checkout-readyEvent emitted when checkout modal is ready.
checkout-dismissedEvent emitted when checkout modal is closed.
checkout-errorEvent emitted when an error occurs with the payment.
boleto-copyEvent emitted when payment with boleto mode is successful and user has copied the barcode.
boleto-complete-purchaseEvent emitted when payment with boleto mode is successful and user clicks complete purchase button.
pix-copyEvent emitted when payment with pix mode is successful and user has copied the pix code.
pix-complete-purchaseEvent emitted when payment with pix mode is successful and user clicks complete purchase button.
oxxo-copyEvent emitted when payment with oxxo mode is successful and user has copied the oxxo barcode.
oxxo-complete-purchaseEvent emitted when payment with oxxo mode is successful and user clicks complete purchase button.
spei-copyEvent emitted when payment with spei mode is successful and user has copied the spei clabe.
spei-complete-purchaseEvent emitted when payment with spei mode is successful and user clicks complete purchase button.
paynet-copyEvent emitted when payment with paynet mode is successful and user has copied the paynet barcode.
paynet-complete-purchaseEvent emitted when payment with paynet mode is successful and user clicks complete purchase button.
paycash-copyEvent emitted when payment with paycash mode is successful and user has copied the paycash barcode.
paycash-complete-purchaseEvent emitted when payment with paycash mode is successful and user clicks complete purchase button.
picpay-complete-purchaseEvent emitted when payment with picpay mode is successful and user clicks complete purchase button.
3ds-successEvent emitted when successfully processed the 3DS payment.
3ds-unenrolledEvent emitted when card does not allow 3DS authentication.
3ds-failureEvent emitted when an error occurs with the 3DS payment.
3ds-errorEvent emitted when an error occurs during 3DS authentication process.

Instance Methods

MethodParameterReturnDescription
mountInHTMLElement / CSS selectorvoidMount the checkout in the DOM and display the pay button.
startnovoidMount the checkout in the DOM and launch the lightbox. With this method, the pay button will not get visible.
closeLightboxnovoidUsed for programmatically closing the lightbox.
onevent, functionvoidAdd an event handler. Acts the same way as .addEventListener from HTML.
offevent, functionvoidRemove an event handler. Acts the same way as .removeEventListener from HTML.

Element Methods

MethodParameterReturnDescription
closeLightboxnovoidUsed for programmatically closing the lightbox.

Handing Events

Using on(event, function) / off(event, function) methods

javascript
   const letpayCheckout = new letpayCheckout({...});
function handler(event) {
console.log(event.detail[0])
};
// to add a listener
letpayCheckout.on('checkout-success', handler);
// to remove a listener
letpayCheckout.off('checkout-success', handler);

Using addEventListener(type, listener) / removeEventListener(type, listener) methods

javascript
  const letpayCheckout = document.querySelector('letpay-checkout');
function handler(event) {
console.log(event.detail[0])
};
// to add a listener
letpayCheckout.addEventListener('checkout-success', handler);
// to remove a listener
letpayCheckout.removeEventListener('checkout-success', handler);

Closing the lightbox

javascript
  letpayCheckout.closeLightbox()