Overview
Simply Connect 2.0 supports the following methods and functions, as detailed on this page.
- simplyConnect()
- getPaymentOptions()
- getBuyerPaymentTokens()
- submitPayment()
- createPaymentToken()
- getTempToken()
- setOpenAmount()
- deletePaymentToken()
- applyOverlay()
- removeOverlay()
- destroy()
Initialization
This section provides information about initialization.
simplyConnect()
The simplyConnect()
method initializes Simply Connect 2.0.
Example Request
window.simplyConnect({ env: env, renderTo: "#root", sessionId: sessionId, // The session ID value is a result of the POST/orders request eventCallbacks: { onResult: function(result) { console.log(result) }, }, uiConfig: { countryCode: "US", }, }) }
simplyConnect()
Input Parameters
Parameter | Type | Description |
---|---|---|
sessionId | string(2) | Mandatory. The sessionId retrieved from a POST/orders request that references the order created in the Nuvei system. |
env | string(4) | Mandatory. The Nuvei environment you are running on. If not provided, the Production environment is assumed. Possible values: prod - Production, int - Integration |
eventCallbacks | string | At each stage of the payment process, you can set an event hook to interrupt the process, allowing you to view and update certain processing parameters, change the processing flow, or continue with the flow. If a payment event is triggered, the callback function performs the actions that you specify. Possible values:
|
logLevel | string(1) | Specifies the console log detail level. Possible values: |
continueWithoutLiabilityShift | Boolean | Allows merchants to switch off the 3DS flow and process transactions without a challenge. Possible values: false (default), true |
uiConfig | block | Allows merchants to customize Simply Connect at initialization phase using the following properties:
|
getPaymentOptions()
The getPaymentOptions()
method returns a list of the configured payment methods per processingEntityId
for a specific merchant. The list is used by Simply Connect 2.0 to display the payment methods within the payment options gallery.
Example Request
simplyConnect.getPaymentOptions().then((result) => console.log(result); });
getBuyerPaymentTokens()
The getBuyerPaymentTokens()
method returns the registered payment methods for a specific user according to the buyerId
.
Example Request
simplyConnect.getBuerPaymentTokens().then((result) => console.log(result); });
submitPayment()
The submitPayment()
method processes end-to-end card payments. The method receives any form of cardholder information, tokenized or not, and performs the entire process including any 3D-Secure or PCI requirements.
simplyConnect.submitPayment();
submitPayment()
Input Parameters
Parameter | Type | Description |
---|---|---|
processingEntityId | uuid | Mandatory. Processing entityId provided by Nuvei. |
transactionId | string(45) | ID of the transaction in the merchant system. |
sourceApplication | string(50) | SIMPLY CONNECT |
custom | object | property name* - string |
deviceDetails | object | Includes:
|
paymentToken | object | Mandatory. Includes:
|
buyerDetails | object | buyerDetails – object . Includes:
|
logging | object | property name* – string |
cvvIcon | Boolean | Determines whether a default icon appears in the CVV entry field, including a mouseover tooltip. Possible values:
|
submitPayment()
Output Parameters
Parameter | Type | Description |
---|---|---|
paymentId | int64 | The ID generated by REST API. |
transactionId | transactionId(20) | Nuvei Digital Payments Gateway Transaction ID. |
externalTransactionId | transactionId(20) | A unique ID generated by Nuvei that represents the APM transaction. |
amount | number | The transaction amount. |
currency | string(3) | The 3-letter ISO currency code. |
transactionType | transactionType | Possible values:
|
result | string | Mandatory. Include the following parameters: status (string) Possible values:
|
authCode | string(128) | The authorization code of the transaction. |
cvv2Code | string(1) | CVV2 (card verification value) response. Possible values:
|
avsCode | string(1) | The AVS (address verification) response. Possible values:
|
partialApproval | object | Include the following parameters:requestedAmount - number (Mandatory)requestedCurrency - string (>= 3 characters, Mandatory) |
redirectUrl | string(2000) | Use to redirect the customer to the payment page for use in future transactions. |
paymentToken | object | Include the following parameters:Card - object, including:
|
providerResponseDetails | object | Include the following parameters:
|
createPaymentToken()
The createPaymentToken()
method is called to add a selected payment option as a new Payment Token (former UPO) during the registration process (not the payment process). The request ensures that metadata required for re-display of the same payment option to the user and preparing for processing on the user’s next visit to the payment page (such as the display name of the payment method, logo, required input to collect from the end user, and so on) is stored by Nuvei and referenced under a unique paymentTokenId
. The paymentTokenId
is returned to the merchant with the getBuyerPaymentTokens()
response if called or automatically with the next simplyConnect()
initialization.
Example Request
new Promise(async (resolve, reject) => { var getTokenResponse = await simplyConnect.createPaymentToken(); // some merchant code here resolve(); // or reject payment });
getTempToken()
The getTempToken()
method is used for advanced cases in which a merchant wants to receive a temporary token to process a card request on the Nuvei server side (via the Nuvei API). The method returns a ccTempToken
, which is a card/CVV pair-token that expires upon expiration of the session token.
Example Request
simplyConnect.getTempToken().then((response ) => { console.log(response); });
setOpenAmount()
The setOpenAmount()
method is used to set or override the payment amount (in the same currency) from the client side.
Use the setOpenAmount()
method in the following cases:
- If an amount is not sent in the
POST /orders
request. - To change a payment amount (same currency) if the
payment()
request is not called yet. For example, if a user changes an amount on the payment page.
Call the setOpenAmount()
method from the client-side, as shown in the following example.
function setOpenAmount() { var openAmount = document.getElementById('openAmount').value; simplyConnect.setOpenAmount(openAmount).then(console.log); }
deletePaymentToken()
deletePaymentToken()
method is used if an option to delete a saved payment token is exposed to the end user of the payments page. If deletion of such a saved payment token is requested, the deletePaymentToken()
function of Simply Connect 2.0 is called and a request to remove the record from the database is sent.Example
simplyConnect.deletePaymentToken("paymentTokenId").then((result) => console.log(result); });
applyOverlay()
If a merchant wants to retain full control of when to apply overlay for Simply Connect 2.0, the following front-end JavaScript function can be called at any time:
simplyConnect.applyOverlay()
removeOverlay()
To remove a previously applied overlay on request, the following front-end JavaScript function is called:
simplyConnect.removeOverlay()
destroy()
The destroy()
method is used to remove the Simply Connect application from the payment page.
simplyConnect.destroy();