Complete Synapse Payment
Complete Synapse Payment
CompleteSynapsePayment()
This JS-API is a callback given to the merchant, once the user completes payment. This callback needs to be registered in the merchant web application so that when the payment is finished Synapse application will give a callback to the merchant application for payment success.
Response data Attributes form callback
ELEMENT | TYPE | DESCRIPTION |
---|---|---|
merchantPaymentPayload | string | AES encrypted payload containing merchant payment reference id sent by merchant in request of Initiate Transaction S2S call. |
paymentStatus | string | Represent the paymentAll Possible value of payment status PAYMENT_SUCCESS, PAYMENT_FAILED, PAYMENT_IN_PROGRESS |
Error Code
ERROR CODE | ERROR MESSAGE |
---|---|
162 | User aborted the Payment |
3 | Something Went Wrong |
Sample Code
const completeSynapsePayment = (data) => {
var responseJSON = JSON.parse(data);
if (responseJSON["error"]) {
initiatePaymentFailure(responseJSON["message"]);
} else {
console.log("payment status from Client side");
console.log(responseJSON.paymentStatus);
// use merchantPaymentPayload to poll your backend to get the final status
}
};
sdk.initCompletePaymentCallback(completeSynapsePayment)