Skip to main content

Payment Links

Payment Links#

Payment Links help you to receive payments from customers by sending them links via email, SMS, chat-bots and more. Payment Links can be created from the CHAIPort admin portal or API. The customer can select their desired payment method and complete the payment.

Generate Payment Link via API#

POST /api/paymentLink

Creates a new payment link and return it along with it's unique id in response.

Parameter list#

ParameterDatatypeObligatory/OptionalDescription
KeyObligatoryCHAIPort Key provided to merchants
MerchantOrderIdObligatoryOrder reference given by merchant ID
AmountObligatoryAmount for transaction
CurrencyObligatoryCurrency for transaction
billing_detailsOptionalDetails of billing
shipping_detailsOptionalDetails of shipping
merchant_detailsOptionalMerchant details
order_detailsObligatoryOrder Details like quantity, id, name, price are mandatory, while image is Optional t
SuccessUrlObligatoryRedirection url for success
FailureUrlObligatoryRedirection url for failure
SignatureObligatorySignature calculated using this link
ExpiryHoursObligatoryTime to expire for the payment link
SourceObligatoryFrom where payment link is created. Can be admin portal, checkout or api for which values are "default", "api", "checkout" respectively.Merchants should add "api" here
DescriptionObligatoryDescription for payment link
Show Shipping DetailsOptionalTo Show/Hide the Shipping Details in Checkout UI
Show Back ButtonOptionalTo Show/Hide the Back Button in Checkout UI
Default Guest CheckoutOptionalTo by default show the guest checkout in Checkout UI
Is Checkout EmbedOptionalTo load the checkout UI in Embedded way

Curl Request:

curl --location --request POST 'https://api.chaiport.io/api/paymentLink' \
--header 'Content-Type: application/json' \
--data-raw '{
"chaipay_key": "NPSkZZYefGyKvBxi",
"merchant_details": {
"name": "Downy",
"logo": "images/v184_135.png",
"back_url": "https://demo.chaiport.io/checkout.html",
"promo_code": "Downy350",
"promo_discount": 35000,
"shipping_charges": 0.0
},
"merchant_order_id": "Merchant1626931942182",
"signature_hash": "flDFcPNx4pASRWonw52s0Sec3ee1PJQrdTklDrZGjq0=",
"amount": 365000,
"currency": "VND",
"country_code": "VN",
"billing_details": {
"billing_name": "Test mark",
"billing_email": "markweins@gmail.com",
"billing_phone": "9998878788",
"billing_address": {
"city": "VND",
"country_code": "VN",
"locale": "en",
"line_1": "address",
"line_2": "address_2",
"postal_code": "400202",
"state": "Mah"
}
},
"shipping_details": {
"shipping_name": "xyz",
"shipping_email": "xyz@gmail.com",
"shipping_phone": "1234567890",
"shipping_address": {
"city": "abc",
"country_code": "VN",
"locale": "en",
"line_1": "address_1",
"line_2": "address_2",
"postal_code": "400202",
"state": "Mah"
}
},
"order_details": [
{
"id":"1",
"price": 200000,
"name": "Stubborn Attachments",
"quantity": 1,
"image":"https://www.demo.chaiport.io/images/bella-toes.jpg"
},
{
"id":"2",
"price": 200000,
"name": "Stubborn Attachments",
"quantity": 1,
"image":"https://www.demo.chaiport.io/images/bella-toes.jpg"
}
],
"success_url": "https://prod-demo.chaiport.io/order-confirmation.html",
"failure_url": "https://prod-demo.chaiport.io/order-failure.html",
"expiry_hours":2,
"source":"api",
"description":"test desc",
"show_shipping_details":true,
"show_back_button":true,
"default_guest_checkout":true,
"is_checkout_embed":true
}'

Response:

{
"payment_link_ref": "1vpwQZorU6u5Dj5SY3tadWaihqV",
"payment_link": "https://checkout.chaiport.io?ref=1vpwQZorU6u5Dj5SY3tadWaihqV"
}