JavaScript Example: Processing a Payment

Payment is initiated when
Unified Checkout
captures the customer's payment information by calling the
unifiedPayment.complete()
function and passing the transient token.
IMPORTANT
If you are updating an existing
Unified Checkout
configuration to use the complete mandate, you must update your JavaScript to include the
unifedPayment.complete()
function.
try { const accept = await Accept(captureContext); const up = await accept.unifiedPayments(sidebar); const tt = await up.show(showArgs); const completeResponse = await up.complete(tt); console.log(completeResponse); // merchant logic for handling complete response } catch (error) { // merchant logic for handling issues console.error("something went wrong: " + error); } }
When you include this in your capture context,
Unified Checkout
is leveraged to initiate payment and any follow-on services that you include in your capture context request. Alternatively, you can call the payment APIs directly. See Authorizations with a Transient Token.