Versapay Ecommerce API (1.1.0)

Download OpenAPI specification:Download

Introduction

The Versapay e-commerce solution is composed of several components. First, is a server-side API that allows your application to configure a new payment session, manage customer wallets, create orders, and initiate payments. In addition, there is a client-side JavaScript SDK that enables your web applicaiton to accept secure payment data via an iframe hosted by Versapay. Your sensitive payment data will not transit your application when you use the iframe, so your application will have a reduced PCI scope.

In order to accept a payment, the general flow is to first create a session using the server-side API. Once a session ID has been generated by the Versapay server and returned to your application, your client-side code can use that session ID to initialize the Versapay payment SDK, which will, in turn, render the iframe. Next, the customer will interact with the iframe to specify a payment method. The SDK will return a token representing that payment method to your client-side code. Your client-side code must return the token to your server-side code, which will then use the original session ID and the token to create an order and take a payment. Finally, your ERP or order fulfillment system will query the Versapay cloud platform for new orders so that they may be created and fulfilled via your standard workflow.

Environments

The UAT environment is a useful sandbox for integration testing where transaction settlements are simulated using test account numbers and test dollar amounts.

https://ecommerce-api-uat.versapay.com

Once integration testing is complete via the UAT environment, start sending your requests to the production URL to start moving money and/or integrating with Versapay.

https://ecommerce-api.versapay.com

Server-side Setup

Wallets

If the customer checking out through your website is a known customer with an authenticated account and you would like the Versapay cloud platform to offer to store payment methods for future use, you can generate a Wallet ID for that customer. To do so, POST to the /wallets endpoint to generate a new Wallet ID. Once the Wallet ID has been returned to your application, it is your application's responsibility to associate the Wallet ID with the customer record in your web application so that it can be provided to the API each time the customer checks out.

If the customer already has a Wallet ID associated with their record in your application, that Wallet ID should be provided in the session creation request.

Sessions

Each checkout attempt requires that your application request a Session ID from the Versapay API. This is accomplished by POSTing to the /sessions endpoint. When creating a new session, you must specify your Versapay gateway credentials, which consist of an API Token and an API Key. These are passed in the http request using an authorization header. In addition, you may pass session options to the API that control the behavior, and verbiage of the checkout experience in the hosted iframe.

Session options also allow you to specify a Wallet ID for the current customer in the wallet element.

The POST request to the /sessions endpoint will return a Session ID to your application. That Session ID must be passed to your client-side JavaScript so that it can initialize the Versapay Checkout Client SDK.

Versapay Checkout Client SDK

The Versapay Checkout JavaScript SDK can be used to initialize a hosted iframe within your ecommerce website that contains all the fields needed to complete a secure credit card transaction while keeping your website out of scope for PCI compliance.

Setup

Install the Versapay library

To start using the SDK, load the library from the hosting url. This will give you access to functions in the versapay module.

<!-- Load the client component -->
<script src="https://ecommerce-api.versapay.com/client.js"></script>

<!-- Call functions in the versapay module -->
<script>
    var client = versapay.initClient(sessionId)
</script>

Get a Session ID

The Versapay SDK requires a Session ID generated by a server side API request. Once you have a Session ID, you can initialize the client.

Create a client instance

Create an instance of the client class using the versapay.initClient function, passing the session key generated on the server side as a parameter.

<script>
    var client = versapay.initClient(sessionId)
</script>

Add styles or fonts

Although you can use the default styles and fonts of the checkout iframe, it can also be configured with styles and fonts that fit with your ecommerce website. These can be passed as optional parameters to the initClient function.

The styles parameter should be sent as a json object of CSS selectors and properties. See the CSS Styling section for a list of supported properties and DOM element IDs that can be used in selectors.

The fontUrls parameter should be an array of urls that point to an embeddable Google Fonts link.

<script>
    var styles = {
        html: {
            "font-family": "DotGothic16",
        },
        input: {
            "font-size": "14pt",
            "color": "#3A3A3A",
        },
        select: {
            "font-size": "14pt",
            "color": "#3A3A3A",
        }
    };

    var fontUrls = ['https://fonts.googleapis.com/css2?family=DotGothic16&display=swap']

    var client = versapay.initClient(clientSession, styles, fontUrls)
</script>

Create DOM elements

The hosted iframe requires two DOM elements, a form and an empty DOM element within the form to act as a container for the iframe. You will likely also want to include a way to submit the form, like a Submit or Pay button, and a way to display submission errors.

<form id='form'>
    <div id='container'></div>
    <div>
        <button id='submit'>Pay</button>
        <span id='submitError'></span>
    </div>
</form>
<script>
    const form = document.querySelector('#form')
    const submit = document.querySelector('#submit')
    const submitError = document.querySelector('#submitError')
</script>

Initialize the iframe and create a frame promise

Initialize the iframe using the client.initFrame async function, passing the empty DOM element and the desired iframe width and height as parameters. Since the iframe will resize its internal elements responsively to fit the width and height specified here, these parameters can be assigned programmatically to ensure that the checkout page displays correctly on all devices. The return value of this function is a promise object that is resolved when the iframe and fields are ready.

<script>
    const form = document.querySelector('#form')
    const submit = document.querySelector('#submit')

    var containerWidth = document.documentElement.clientWidth > 500 ? '500px' : '400px'

    versapay.initClient(clientSession).then(function(client) {
        frameReadyPromise = client.initFrame(document.querySelector('#container'), '500px', containerWidth)
    }
</script>

Listen for payment method approval events

When the selected payment method is approved or rejected by the hosted iframe, an approval promise is fulfilled or rejected in the instance of the client class. Use the client.onApproval(onResolve, onReject) function to return the results of the approval promise, where the parameters are callback functions to execute when the promise is fullfilled or rejected.

<script>
    client.onApproval(
        onResolve = result => {
            // this is the callback function to use when the payment method is approved
            console.log(result)
        }, 
        onReject = error => {
            // this is the callback function to use when the payment method is rejected
            console.log(error)
        }
    )
</script>

Create the submit event handler

Add an event handler for the form submit event that calls the client.submitEvents() function. The submitEvents() function triggers a submission on the form in the hosted iFrame, which returns the results of that submission to the approval event in the client instance.. Note that the form.then() function is also useful for handling any other code that should be executed once the frame and fields are ready for input, like setting a form submit button to enabled.

<script>
    const form = document.querySelector('#form')
    const submit = document.querySelector('#submit')

    versapay.initClient(clientSession).then(function(client) {
        frameReadyPromise = client.initFrame(document.querySelector('#container'), '500px', '250px')

        frameReadyPromise.then(function() {
            submit.removeAttribute('disabled')

            form.addEventListener('submit', function(event) {
                event.preventDefault()
                var tokenPromise = client.submitEvents()
            })
        })
    }
</script>

Receive the payment method submission results from the iframe

After the form is submitted, the results of the payment method submission are passed back to the iframe. The submission results are returned to the client library using the [approval promise] on the client instance. When the approval promise is fulfilled, the results will return a json object containing the payment type and a token that can be passed back up to the server side code to perform a charge, authorization, etc. If the approval promise is rejected, the error can be used in the callback function.

<script>
    client.onApproval(
        onResolve = result => {
            // this is the callback function to use when the payment method is approved
            // the result.paymentType value can be used to conditionally handle different payment types (creditCard, ach, giftCard)
            // the result.token value can be passed up to the server-side code to use for other operations
            console.log(`Payment Type: ${result.paymentType}, Token: ${result.token}`)
        }, 
        onReject = error => {
            // this is the callback function to use when the payment method is rejected
            // the error.paymentType value can be used to conditionally handle different payment types (creditCard, ach, giftCard)
            // the error.error value will contain more information about the payment method error
            console.log(`Payment Type: ${error.paymentType}, Error: ${error.error}`)
            submitError.textContent = error.error
        }
    )
</script>

Example HTML Code

<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Versapay JS Ecomm Library Demo</title>
        <style>
            @import url('https://fonts.googleapis.com/css2?family=Yantramanav&display=swap');
        </style>
    </head>
    <body>
        <form id='form'>
            <div id='container' style="height:358px; width:500px"></div>
            <div style="position: relative">
                <button id='submit' style=
                    "width:420px; 
                    height:50px; 
                    color:#FFFFFF; 
                    font-size: 18px; 
                    line-height: 20px;
                    background-color:#002233; 
                    margin: 16px 40px;
                    font-family: Yantramanav;
                    padding-left: 20px;
                    border: 0;
                    border-radius: 3px;"
                >Pay</button>
                <img src="./lock.svg" style="position:absolute; left:214px; top: 28px; height: 25px; width: 25px;"/>
                <span id='submitError' style=
                    "line-height: 14px;
                    color: red;
                    font-size: 12px;
                    font-family: Yantramanav;
                    position: absolute;
                    bottom: -5px;
                    left: 42px;"
                ></span>
            </div>
        </form>
        <script src="http://localhost:9000/client.js"></script>
        <script>
            const form = document.querySelector('#form')
            const submit = document.querySelector('#submit')
            const submitError = document.querySelector('#submitError')

            // Get the Session ID from the server side API.
            var clientSession = '24653110-410a-49f2-9ee3-477f6bfe06b3'

            // Set any custom styles to pass to the iFrame.
            var styles = {
                // html: {
                //     "font-family": "DotGothic16",
                // },
                // input: {
                //     "font-size": "14pt",
                //     "color": "#3A3A3A",
                // },
                // select: {
                //     "font-size": "14pt",
                //     "color": "#3A3A3A",
                // }
            };

            // Set custom google font families to display in the iFrame.
            var fontUrls = ['https://fonts.googleapis.com/css2?family=DotGothic16&display=swap']

            // Initialize the client with the Session ID and any custom styles or fonts.
            var client = versapay.initClient(clientSession, styles, fontUrls)

            // Instantiate the iFrame from client object using the target dom and set the frame height and width.
            var frameReadyPromise = client.initFrame(document.querySelector('#container'), '358px', '500px')

            // Initialize approval callbacks to handle success/failure of tokenization or payment in the iframe
            client.onApproval(
                onResolve = result => {
                    // this is the callback function to use when the payment method is approved
                    // the result.paymentType value can be used to conditionally handle different payment types (creditCard, ach, giftCard)
                    // the result.token value can be passed up to the server-side code to use for other operations
                    console.log(result)
                }, 
                onReject = error => {
                    // this is the callback function to use when the payment method is rejected
                    // the error.paymentType value can be used to conditionally handle different payment types (creditCard, ach, giftCard)
                    // the error.error value will contain more information about the payment method error
                    console.log(error)
                }
            )

            // The client.initFrame function returns a promise that resolves when the iFrame is ready to be used
            frameReadyPromise.then(function() {       
                // Code that is placed here will run after the iFrame is ready.
                // For instance, you can disable your form submit button and 
                // only allow clicks after the iFrame is ready.
                submit.removeAttribute('disabled')

                // Add an event listener for your form submission.
                form.addEventListener('submit', function(event) {
                    event.preventDefault()

                    // Use submit to trigger the submit event on the form in the iframe
                    client.submitEvents()
                })
            })
        </script>
    </body>
</html>

CSS Styling


DOM Element IDs

The following IDs can be used as CSS selectors in the style json that can be passed as a parameter to initClient.

#accountNoDiv
#accountNo
#cardholderNameDiv
#cardholderName
#expDateDiv
#expDate
#expMonth
#expYear
#cvvDiv
#cvv

Supported CSS properties

'-moz-appearance',
'-moz-osx-font-smoothing',
'-moz-tap-highlight-color',
'-moz-transition',
'-webkit-appearance',
'-webkit-font-smoothing',
'-webkit-tap-highlight-color',
'-webkit-transition',
'appearance',
'background-color',
'border',
'border-radius',
'color',
'direction',
'font',
'font-family',
'font-size',
'font-size-adjust',
'font-stretch',
'font-style',
'font-variant',
'font-variant-alternates',
'font-variant-caps',
'font-variant-east-asian',
'font-variant-ligatures',
'font-variant-numeric',
'font-weight',
'letter-spacing',
'line-height',
'margin',
'margin-top',
'margin-right',
'margin-bottom',
'margin-left',
'opacity',
'outline',
'padding',
'padding-top',
'padding-right',
'padding-bottom',
'padding-left',
'text-align',
'text-shadow',
'transition',
'flex-direction',
'flex-flow',
'flex-basis',
'flex-shrink',
'flex-grow',
'flex-wrap',
'justify-content',
'flex',
'align-self',
'align-items',
'align-content'

Server-side Orders and Payments

Once your client-side script has received the payment token from the Versapay Client SDK and passed it to your server-side application, you need to use the API to create and order and process a payment. Depending on your checkout scenario, this can be done in a single step, or it can be split into multiple steps to support more complex flows.

When an order is created, it has a status of either Finalized or Not Finalized. Only Finalized orders will be brought into your ERP or order fulfillment system. If you are attempting to use a single payment method for the order, you can use the one-step process. The one-step process will automatically Finalize the order if the payment is approved. Other scenarios, which may include zero payments (e.g., the order is being paid via a Purchase Order) or multiple payments (e.g., the order payment is being split between two credit cards), require that you:

  1. Create the order without any payments
  2. Request zero or more payments necessary for order completion
  3. If all payments are successful, Finalize the order to signal that it is ready to be retrieved by the ERP or order fulfillment system

Create an Order

When you POST to /sessions/{sessionId}/sales, the Versapay system will create an order based on the data that you supply in your request. Your POST can include a payment element if the intent is to take exactly one payment for the order.

If successful, the API will return an Order ID, the Finalization status, and, if a payment was requested, the payment response information.

Always check the Finalization status of the order. If the payment was approved, but the order was not automatically finalized, you should send a PATCH request to finalize the order yourself.

Create a Payment

If your intent is to process multiple payments against an order, and you have already create the order and have an Order ID, you can POST to the /sessions/{sessionId}/sales/{saleId}/payments endpoint to request a payment against the order.

Once all payments are successful, you must finalize the order.

Order Finalization

When you are finished with an order and are ready for the ERP or order fulfillment system to retrieve it, you can finalize the order by sending a PATCH request to the /sessions/{sessionId}/sales/{saleId} endpoint. If finalization is successful, the API will return a response indicating that the order has been finalized.

developers

Operations available to developers

create a session

By passing in the appropriate options, you can create an iframe session with options that meet your needs. If successful, this operation will return a session id in the "id" property of the response. Your application can then use that session id when initializing our client-side JavaScript library, which will inject an iframe into your page. The iframe will be rendered using the options you specify. When sensitive payment data is entered into the iframe, it will be tokenized by our servers, and that token will be returned to your page via JavaScript. Your page should post that token back to your server and use it to make a follow-on API call to create an order and payment.

Request Body schema: application/json

These are the options for the iframe session

gatewayAuthorization
required
UnifiedAuthorization (object) or TPro4Authorization (object) (GatewayAuthorization)
options
required
object (SessionOption)

An option for a specific session

Responses

201

The session has been created

401

Gateway authentication error

post /sessions

Production

https://ecommerce-api.versapay.com/api/v1/sessions

User Acceptance Testing (UAT)

https://ecommerce-api-uat.versapay.com/api/v1/sessions

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "gatewayAuthorization":
    {
    },
  • "options":
    {
    }
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": "d290f1ee-6c54-4b01-90e6-d701748f0851"
}

create a wallet for a known user

This operation will create a new wallet for a known customer. If the customer is using a guest checkout feature, wallets should not be used until an account is created and the customer becomes known.

Request Body schema: application/json

These are the authentication parameters for the gateway

gatewayAuthorization
required
UnifiedAuthorization (object) or TPro4Authorization (object) (GatewayAuthorization)

Responses

201

The wallet has been created

400

Bad input parameter

post /wallets

Production

https://ecommerce-api.versapay.com/api/v1/wallets

User Acceptance Testing (UAT)

https://ecommerce-api-uat.versapay.com/api/v1/wallets

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "gatewayAuthorization":
    {
    }
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "walletId": "1NQGAW7N4S7H"
}

process a sale

This operation will send a new order to our server. You can optionally process a payment transaction in a single operation. However, if you need to process multiple payment transactions, you should use the seperate payment operation. If a payment is included, the order will be finalized if the payment is approved. If a payment is not included, the order will not be finalized, and a PATCH request will be required to finalize the order once all payments have been processed.

path Parameters
id
required
string <uuid> (SessionID)
Example: d290f1ee-6c54-4b01-90e6-d701748f0851

Session ID

Request Body schema: application/json
customerNumber
string

The Customer identifier as the Customer is known to the ERP system

orderNumber
required
string non-empty

The Order identifier generated by the shopping cart system

purchaseOrderNumber
string

The customer's Purchase Order Number

shippingAgentNumber
string

The Shipping Agent identifier known to the ERP system

shippingAgentServiceNumber
string

The Shipping Agent Service identifier known to the ERP system

shippingAgentDescription
string

A description or name of the Shipping Agent

shippingAgentServiceDescription
string

A description or name of the Shipping Agent Service

currency
required
string (Currency) 3 characters ^[A-Z]{3,3}$

The uppercase 3-letter ISO currency code

billingAddress
required
object (Address)

An Address

shippingAddress
required
object (Address)

An Address

lines
required
Array of objects (SaleLine) non-empty

The collection of order lines

shippingAmount
number <float> >= 0

The amount being charged for freight, expressed in the currency of the current sale

discountAmount
number <float> >= 0

The order-level discount amount, expressed as a positive value, in the currency of the current sale

taxAmount
number <float> >= 0

The sales tax amount, expressed in the currency of the current sale

payment
object (Payment)

A Payment

Responses

201

The order has been created

400

Bad input parameter

404

Session not found

post /sessions/{id}/sales

Production

https://ecommerce-api.versapay.com/api/v1/sessions/{id}/sales

User Acceptance Testing (UAT)

https://ecommerce-api-uat.versapay.com/api/v1/sessions/{id}/sales

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "customerNumber": "C1234",
  • "orderNumber": "SO1234",
  • "purchaseOrderNumber": "PO1234",
  • "shippingAgentNumber": "USPS",
  • "shippingAgentServiceNumber": "PRIORITY",
  • "shippingAgentDescription": "United States Postal Service",
  • "shippingAgentServiceDescription": "Priority Mail",
  • "currency": "USD",
  • "billingAddress":
    {
    },
  • "shippingAddress":
    {
    },
  • "lines":
    [
    ],
  • "shippingAmount": 5.05,
  • "discountAmount": 10.5,
  • "taxAmount": 1.05,
  • "payment":
    {
    }
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "orderId": "d290f1ee-6c54-4b01-90e6-d701748f0851",
  • "finalized": true,
  • "payment":
    {
    }
}

update a sale

This operation will update an existing order on our server to finalize the order and get it ready for import.

path Parameters
id
required
string <uuid> (SessionID)
Example: d290f1ee-6c54-4b01-90e6-d701748f0851

Session ID

saleid
required
string (OrderID) non-empty
Example: d290f1ee-6c54-4b01-90e6-d701748f0851

Order ID

Responses

202

The order has been updated

400

Bad input parameter

404

Session not found

patch /sessions/{id}/sales/{saleid}

Production

https://ecommerce-api.versapay.com/api/v1/sessions/{id}/sales/{saleid}

User Acceptance Testing (UAT)

https://ecommerce-api-uat.versapay.com/api/v1/sessions/{id}/sales/{saleid}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "orderId": "d290f1ee-6c54-4b01-90e6-d701748f0851",
  • "finalized": true,
  • "payment":
    {
    }
}

process a payment

Use this operation to authorize a payment instrument for an existing sale. You must have already created the sale.

path Parameters
id
required
string <uuid> (SessionID)
Example: d290f1ee-6c54-4b01-90e6-d701748f0851

Session ID

saleid
required
string (OrderID) non-empty
Example: d290f1ee-6c54-4b01-90e6-d701748f0851

Order ID

Request Body schema: application/json
type
required
string (PaymentMethod)
Enum: "creditCard" "ach" "giftCard"

The payment type

settlementToken
string (SettlementToken) non-empty ^[0-9A-Za-z-]+

The token associated with a settlement account

token
required
string (FundToken) non-empty ^[0-9A-Za-z-]+

The token associated with a funding source

amount
required
number <float> >= 0

The payment amount, expressed in the currency of the current sale

capture
required
boolean

Indicates if the gateway should capture the funds or just reserve the funds via an authorization

Responses

201

The payment has been created

400

Bad input parameter

404

Session not found

post /sessions/{id}/sales/{saleid}/payments

Production

https://ecommerce-api.versapay.com/api/v1/sessions/{id}/sales/{saleid}/payments

User Acceptance Testing (UAT)

https://ecommerce-api-uat.versapay.com/api/v1/sessions/{id}/sales/{saleid}/payments

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "type": "creditCard",
  • "settlementToken": "1NQGAW7N4S7H",
  • "token": "1NQGAW7N4S7H",
  • "amount": 123.45,
  • "capture": false
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "approvalCode": 123456,
  • "avsResponseCode": "M",
  • "accountNumberLastFour": "1234",
  • "accountType": "Visa",
  • "token": "1NQGAW7N4S7H",
  • "amount": 10,
  • "transactionId": "string"
}

internal

Operations intended only to the iframe front end

get a session

Retrieve a session and its options for constructing an iframe

path Parameters
id
required
string <uuid> (SessionID)
Example: d290f1ee-6c54-4b01-90e6-d701748f0851

Session ID

Responses

200

The session was found

404

The sesssion was not found

get /sessions/{id}

Production

https://ecommerce-api.versapay.com/api/v1/sessions/{id}

User Acceptance Testing (UAT)

https://ecommerce-api-uat.versapay.com/api/v1/sessions/{id}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "fields":
    [
    ],
  • "wallet":
    {
    },
  • "paymentTypes":
    [
    ],
  • "avsRules":
    {
    },
  • "property1": { },
  • "property2": { }
}

get a token

Get the token for a plaintext account number

path Parameters
id
required
string <uuid> (SessionID)
Example: d290f1ee-6c54-4b01-90e6-d701748f0851

Session ID

Request Body schema: application/json
Any of
  • CreditCard
  • ACH
  • GiftCard
accountHolder
string (AccountHolder) non-empty

The name of the cardholder

accountNumber
required
string (CardAccountNumber) <= 19 characters ^\d{1,19}$

The card account number

expirationMonth
required
integer (CardExpirationMonth) [ 1 .. 12 ]

The expiration month, expressed as an integer from 1 (January) to 12 (December)

expirationYear
required
integer (CardExpirationYear) [ 2020 .. 2099 ]

The expiration year, expressed as a 4-digit year

cardVerificationValue
string (CardVerificationValue) [ 3 .. 4 ] characters ^\d{3,4}$

The card verification value

type
required
string (PaymentMethod)
Enum: "creditCard" "ach" "giftCard"

The payment type

addToWallet
boolean

Set this to true to add the payment method to the customer's wallet

Responses

201

The token was created

400

Bad input parameter

403

Unauthorized

404

The session was not found

500

Tokenization error

post /sessions/{id}/tokens

Production

https://ecommerce-api.versapay.com/api/v1/sessions/{id}/tokens

User Acceptance Testing (UAT)

https://ecommerce-api-uat.versapay.com/api/v1/sessions/{id}/tokens

Request samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "accountHolder": "Jane Smith",
  • "accountNumber": 4111111111111111,
  • "expirationMonth": 12,
  • "expirationYear": 2030,
  • "cardVerificationValue": 123,
  • "type": "creditCard",
  • "addToWallet": false
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "token": "1NQGAW7N4S7H"
}

update a credit card wallet entry

This operation will update an existing credit card wallet entry with information collected from the buyer.

path Parameters
id
required
string <uuid> (SessionID)
Example: d290f1ee-6c54-4b01-90e6-d701748f0851

Session ID

walletid
required
string (WalletID) non-empty ^[0-9A-Z]+
Example: 1NQGAW7N4S7H

Wallet ID

creditcardid
required
string (FundToken) non-empty ^[0-9A-Za-z-]+
Example: 1NQGAW7N4S7H

Credit Card Token

Request Body schema: application/json
accountHolder
string (AccountHolder) non-empty

The name of the cardholder

expirationMonth
integer (CardExpirationMonth) [ 1 .. 12 ]

The expiration month, expressed as an integer from 1 (January) to 12 (December)

expirationYear
integer (CardExpirationYear) [ 2020 .. 2099 ]

The expiration year, expressed as a 4-digit year

cardVerificationValue
string (CardVerificationValue) [ 3 .. 4 ] characters ^\d{3,4}$

The card verification value

Responses

202

The wallet has been updated

400

Bad input parameter

403

Unauthorized

404

Session or wallet not found

patch /sessions/{id}/wallet/{walletid}/creditcards/{creditcardid}

Production

https://ecommerce-api.versapay.com/api/v1/sessions/{id}/wallet/{walletid}/creditcards/{creditcardid}

User Acceptance Testing (UAT)

https://ecommerce-api-uat.versapay.com/api/v1/sessions/{id}/wallet/{walletid}/creditcards/{creditcardid}

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "accountHolder": "Jane Smith",
  • "expirationMonth": 12,
  • "expirationYear": 2030,
  • "cardVerificationValue": 123
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "not found",
  • "errors":
    [
    ]
}

remove a credit card wallet entry

This operation will remove an existing credit card entry from a wallet.

path Parameters
id
required
string <uuid> (SessionID)
Example: d290f1ee-6c54-4b01-90e6-d701748f0851

Session ID

walletid
required
string (WalletID) non-empty ^[0-9A-Z]+
Example: 1NQGAW7N4S7H

Wallet ID

creditcardid
required
string (FundToken) non-empty ^[0-9A-Za-z-]+
Example: 1NQGAW7N4S7H

Credit Card Token

Responses

202

The wallet has been updated

400

Bad input parameter

403

Unauthorized

404

Session or wallet not found

delete /sessions/{id}/wallet/{walletid}/creditcards/{creditcardid}

Production

https://ecommerce-api.versapay.com/api/v1/sessions/{id}/wallet/{walletid}/creditcards/{creditcardid}

User Acceptance Testing (UAT)

https://ecommerce-api-uat.versapay.com/api/v1/sessions/{id}/wallet/{walletid}/creditcards/{creditcardid}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "not found",
  • "errors":
    [
    ]
}

update a bank account wallet entry

This operation will update an existing bank account wallet entry with information collected from the buyer.

path Parameters
id
required
string <uuid> (SessionID)
Example: d290f1ee-6c54-4b01-90e6-d701748f0851

Session ID

walletid
required
string (WalletID) non-empty ^[0-9A-Z]+
Example: 1NQGAW7N4S7H

Wallet ID

bankaccountid
required
string (FundToken) non-empty ^[0-9A-Za-z-]+
Example: 1NQGAW7N4S7H

Bank Account Token

Request Body schema: application/json
accountHolder
string (AccountHolder) non-empty

The name of the cardholder

Responses

202

The wallet has been updated

400

Bad input parameter

403

Unauthorized

404

Session or wallet not found

patch /sessions/{id}/wallet/{walletid}/bankaccounts/{bankaccountid}

Production

https://ecommerce-api.versapay.com/api/v1/sessions/{id}/wallet/{walletid}/bankaccounts/{bankaccountid}

User Acceptance Testing (UAT)

https://ecommerce-api-uat.versapay.com/api/v1/sessions/{id}/wallet/{walletid}/bankaccounts/{bankaccountid}

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "accountHolder": "Jane Smith"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "not found",
  • "errors":
    [
    ]
}

remove a bank account wallet entry

This operation will remove an existing bank account entry from a wallet.

path Parameters
id
required
string <uuid> (SessionID)
Example: d290f1ee-6c54-4b01-90e6-d701748f0851

Session ID

walletid
required
string (WalletID) non-empty ^[0-9A-Z]+
Example: 1NQGAW7N4S7H

Wallet ID

bankaccountid
required
string (FundToken) non-empty ^[0-9A-Za-z-]+
Example: 1NQGAW7N4S7H

Bank Account Token

Responses

202

The wallet has been updated

400

Bad input parameter

403

Unauthorized

404

Session or wallet not found

delete /sessions/{id}/wallet/{walletid}/bankaccounts/{bankaccountid}

Production

https://ecommerce-api.versapay.com/api/v1/sessions/{id}/wallet/{walletid}/bankaccounts/{bankaccountid}

User Acceptance Testing (UAT)

https://ecommerce-api-uat.versapay.com/api/v1/sessions/{id}/wallet/{walletid}/bankaccounts/{bankaccountid}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "not found",
  • "errors":
    [
    ]
}