Skip to main content

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

ELEMENTTYPEDESCRIPTION
merchantPaymentPayloadstringAES encrypted payload containing merchant payment reference id sent by merchant in request of Initiate Transaction S2S call.
paymentStatusstringRepresent the paymentAll Possible value of payment status PAYMENT_SUCCESS, PAYMENT_FAILED, PAYMENT_IN_PROGRESS

Error Code

ERROR CODEERROR MESSAGE
162User aborted the Payment
3Something 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)