Class: Accept
Accept
Returns
Type: Promise.<Accept>
Example
Basic Setup
<script src= "https://apitest.example.com/up/v1/assets/0.19.0/SecureAcceptance.js" script> // note: script location should be sourced from capture context response // "clientLibrary": "https://apitest.cybersource.com/up/v1/assets/0.19.0/SecureAcceptance.js", //"clientLibraryIntegrity": "sha256-ZYCOknqXyn4Zwsr8V0hNNr6ZR+Ya8IlsdtZeNHOl2XU=" <script> Accept('header.payload.signature').then(function(accept) { // use accept object }); </script>
Methods
dispose()
→ {void}Dispose of this Accept instance.
Returns
Type: void
unifiedPayments(sidebar)
→ {Promise.<UnifiedPayments>}
Create a Unified Payments integration.
Name | Type | Attributes | Description |
---|---|---|---|
sidebar | Boolean | <optional> | Set the option to
false to enable embedded functionality of
Unified Checkout. This will configure Unified Checkout to place the
Payment Entry form inline. If this value is not set, the default is
true and Unified Checkout will open the Payment
Entry form in the sidebar configuration. |
Throws:
AcceptErrorReturns:
Type: Promise.<UnifiedPayments>
Examples
Minimal Setup - sidebar
var captureContext = document.getElementById('captureContext').value; Accept(captureContext) .then(accept => accept.unifiedPayments())
Embedded Payment Entry
var captureContext = document.getElementById('captureContext').value; Accept(captureContext) .then(accept => accept.unifiedPayments(false))
Error Handling
var captureContext = document.getElementById('captureContext').value; Accept(captureContext) .then(accept => accept.unifiedPayments()) .then(up => up.show(showArgs)) .then(tt => { document.getElementById('transientToken').value = tt; document.getElementById("authForm").submit(); }) .catch(error => { console.error(error); document.getElementById('logo').text = `Checkout error: ${JSON.stringify(error)}. Try again.`; });