Skip to content

Payment Order

Confirm a Payment

liquido.confirmPayment(options)

Use liquido.confirmPayment to confirm a PaymentOrder using data collected by the Payment Element. When called, liquido.confirmPayment will attempt to complete any required actions. Your user will be redirected to the return_url you pass once the confirmation is complete.

options object parameters

Parameter Required Type Description
elements String The Elements instance that was used to create the Payment Element.
confirmParams Object Parameters that will be passed on to the Liquido API.
redirect String enum of 'always' or 'if_required'. By default, liquido.confirmPayment will always redirect to your return_url after a successful confirmation. If you set redirect: "if_required", then liquido.confirmPayment will only redirect if your user chooses a redirect-based payment method.

confirmParams object parameters

Parameter Required Type Description
return_url String The url your customer will be directed to after they complete payment.
shipping Object The shipping details for the payment, if collected.

shipping object parameters

Parameter Required Type Description
address String Shipping address.
name Object Recipient name.
carrier Object The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc.
phone Object Recipient phone (including extension).
tracking_number Object The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas.

address object parameters

Parameter Required Type Description
zipCode String zip code. such as CEP in Brazil
state String state. should be abbreviation, such as SP in Brazil
city String city name.
district String district name.
street String street name.
number String street number.
complement String complement info.
country String country code.

Returns

liquido.confirmPayment will return a Promise. Upon a successful confirmation, your user will be redirected to the return_url you provide before the Promise ever resolves. If the confirmation fails, the Promise will resolve with an {error} object that describes the failure. When the error type is card_error or validation_error, you can display the error message in error.message directly to your user.

Retrieve a payment order

liquido.retrievePaymentOrder(orderCredentials)

Retrieve a PaymentOrder using its order credentials.

Parameters

Parameter Required Type Description
orderCredentials String Required to use with the Payment Element. the order credentials of PaymentOrder

Returns

This method returns a Promise which resolves with a result object. This object has either: - result.paymentOrder: a PaymentOrder was retrieved successfully. - result.error: an error. Refer to the API reference for all possible errors.

Back to top