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 PortOne 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. Refer API docs for additional information.

Parameter list#

ParameterDatatypeObligatory/OptionalDescription
portone_keystringObligatoryUnique PortOne key for the merchant
merchant_order_idstringObligatoryThe unique Merchant Order reference generated by merchant
amountdoubleObligatoryThe amount of transaction, can be floating point number
currencystringObligatoryThe currency of transaction
country_codestringObligatoryThe country code of transaction
billing_detailsobjectOptionalThe JSON object for billing details
shipping_detailsobjectOptionalThe JSON object for shipping details
merchant_detailsobjectObligatoryMerchant details - name, promo_discount and shipping_charges are required field (promo_discount and shipping_charges must be set to 0 when not required)
order_detailsarray of objectsOptionalOrder Details like quantity, id, name, price are mandatory, while image is optional
success_urlstringObligatoryThe url of success page hosted by merchant.
failure_urlstringObligatoryThe url of failure page hosted by merchant.
pending_urlstringObligatoryThe url of pending page hosted by merchant.
signature_hashstringObligatorySignature calculated using this link
expiry_datestringOptionalDate and time to expire for the payment link in UTC format
sourcestringObligatoryFrom 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
descriptionstringOptionalDescription for payment link
environmentstringObligatoryEnvironment of transaction either live OR sandbox
show_shipping_detailsbooleanOptionalTo Show/Hide the Shipping Details in Checkout UI
show_back_buttonbooleanOptionalTo Show/Hide the Back Button in Checkout UI
default_guest_checkoutbooleanOptionalTo by default show the guest checkout in Checkout UI
is_checkout_embedbooleanOptionalTo load the checkout UI in Embedded way
notify_by_emailbooleanOptionalTo notify customer by email
notify_by_phonebooleanOptionalTo notify customer by phone

Curl Request:

curl --location --request POST 'https://api.portone.cloud/api/paymentLink' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjI2NDk3NjU5MDEsImlhdCI6MTY0OTc2NTkwMSwiaXNzIjoiQ0hBSVBBWSIsInN1YiI6Ik5QU2taWlllZkd5S3ZCeGkifQ.VHicuV4dvfp8skktlcRVJNS_WwsD_MtKB4JLBbLWOcQ' \
--header 'Content-Type: application/json' \
--header 'X-Portone-Client-Key: NPSkZZYefGyKvBxi' \
--header 'accept: application/json' \
--data-raw '{
"portone_key": "NPSkZZYefGyKvBxi",
"merchant_details": {
"name": "Downy",
"logo": "images/v184_135.png",
"back_url": "https://demo.portone.cloud/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",
"success_url": "https://checkout.portone.cloud/success.html",
"failure_url": "https://checkout.portone.cloud/failure.html",
"pending_url": "https://checkout.portone.cloud/pending.html",
"source":"api",
"environment":"live"
}'
Detailed curl request (including optional fields).

Curl Request:

curl --location --request POST 'https://api.portone.cloud/api/paymentLink' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjI2NDk3NjU5MDEsImlhdCI6MTY0OTc2NTkwMSwiaXNzIjoiQ0hBSVBBWSIsInN1YiI6Ik5QU2taWlllZkd5S3ZCeGkifQ.VHicuV4dvfp8skktlcRVJNS_WwsD_MtKB4JLBbLWOcQ' \
--header 'Content-Type: application/json' \
--header 'X-Portone-Client-Key: NPSkZZYefGyKvBxi' \
--header 'accept: application/json' \
--data-raw '{
"portone_key": "NPSkZZYefGyKvBxi",
"merchant_details": {
"name": "Downy",
"logo": "images/v184_135.png",
"back_url": "https://demo.portone.cloud/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.portone.cloud/images/bella-toes.jpg",
"additional_details": {
"type": "Shoes"
}
},
{
"id":"2",
"price": 200000,
"name": "Stubborn Attachments",
"quantity": 1,
"image":"https://www.demo.portone.cloud/images/bella-toes.jpg"
},
],
"success_url": "https://checkout.portone.cloud/success.html",
"failure_url": "https://checkout.portone.cloud/failure.html",
"pending_url": "https://checkout.portone.cloud/pending.html",
"expiry_date": "2020-02-27T14:30:00.000Z",
"source":"api",
"environment":"live",
"description":"test desc",
"show_shipping_details":true,
"show_back_button":true,
"default_guest_checkout":true,
"is_checkout_embed":true,
"notify_by_email":false,
"notify_by_phone":false
}'

Response:

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