Build Redirect Payment Page
Create Payment Session
A windowed time for the end customer to complete the payment, starting when the client initiates the payment request through your app. The payment session duration is customizable, with a default duration of 15 minutes.
POST [BASE_URL]/v2/payments
{
"clientReferenceId": "1743240980",
"amount": {
"value": 10000,
"currency": "IDR"
},
"paymentMethod": {
"type": "VIRTUAL_ACCOUNT"
},
"paymentMethodOptions": {
"virtualAccount": {
"channel": "PERMATA",
"virtualAccountName": "Reforza Harsya"
}
},
"mode": "REDIRECT",
"redirectUrl": {
"successReturnUrl": "https://merchant.com/success",
"failureReturnUrl": "https://merchant.com/failure",
"expirationReturnUrl": "https://merchant.com/expiration"
},
"autoConfirm": true,
"statementDescriptor": "Harsya",
"expiryAt": "2025-03-31T23:59:05Z",
"metadata": {
"invoiceNo": "INV001"
}
}Define Payment Method (For final payment method)
Set autoConfirm to true and fill paymentMethod and paymentMethodOptions object to finalize payment method from the previous step
{
"paymentMethod": {
"type": "VIRTUAL_ACCOUNT"
},
"paymentMethodOptions": {
"virtualAccount": {
"channel": "PERMATA",
"virtualAccountName": "Reforza Harsya"
}
},
"autoConfirm": true
}Send us your Success, Failure, and Expired Payment Session URL
Handle Success, Failure, and Expired cases on your Payment Session
{
"redirectUrl": {
"successReturnUrl": "https://merchant.com/success",
"failureReturnUrl": "https://merchant.com/failure",
"expirationReturnUrl": "https://merchant.com/expiration"
}
}Confirm Payment Session (For incomplete payment method)
If you set autoConfirm to false on Create Payment Session API, you can finalize Payment Method by filling paymentMethod and paymentMethodOptions objects
POST [BASE_URL]/v2/payments/{id}/confirm
{
"paymentMethod": {
"type": "VIRTUAL_ACCOUNT"
},
"paymentMethodOptions": {
"virtualAccount": {
"channel": "PERMATA",
"virtualAccountName": "Reforza Harsya"
}
}
}Redirect to Payment Page
After creating and confirming Payment Session, redirect your customer to the URL for the Payment page returned in the response.
{
"paymentUrl": "https://payment.harsya.com/detail?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1dWlkIjoiN2Y2NWM3NTctMzU1Zi00NjQ1LWFjMTQtMDI4YjM0YWI1MWIxIiwiaXNzIjoiYmFja2VuZC1wb3J0YWwiLCJleHAiOjE3NDM0NjU1NDV9.55-QdvI0xVtivNLJzREPDGzUbqFNEj7ouFUCvrzAIbw"
}Simulate Payment
Visit the Payment Page and Simulate the Payment
Last updated