PAYMENTS
SIMPLIFIED


Offer all the payment features your
customers want with a fast integration
that limits your PCI scope.

GET STARTED

API Base URLs

  • Production Server

    For processing live transactions

    https://api.payjunction.com

  • Test Server

    For development

    https://api.payjunctionlabs.com

Most Commonly Referred to Articles

PayJunction JavaScript SDK

Use PayJunction's JavaScript SDK to securely tokenize sensitive customer information on the web.

Getting Started

First, include the PayJunction SDK by adding the script tag to the head of your HTML page.

<html>
<head>
...
<script type="text/javascript" src="https://www.payjunctionlabs.com/trinity/js/sdk.js"></script>
...
</head>

Next, create an instance of the PayJunction object by providing your publishable key as the first parameter.

var payjunction = PayJunction('YOUR_PUBLISHABLE_KEY');

Finally, send the card details entered by the customer to receive the single-use token.

payjunction.createToken({
cardNumber: '4444333322221111',
cardExpMonth: '12',
cardExpYear: '30',
cardCvv: '999'
})
.then(function(result) {
if (result.tokenId) {
...
}
});

SDK Reference

Introduction

This is a reference of all the resources available in our client-side JavaScript SDK, sdk.js.

Including sdk.js

sdk.js is available at the following URLs:

  • Test https://www.payjunctionlabs.com/trinity/js/sdk.js
  • Production https://www.payjunction.com/trinity/js/sdk.js

Add the script to the pages of your website that need it (for example, your checkout page).

Always load the script directly from our servers rather than hosting it on your website to receive security updates and new features.

Initializing sdk.js

PayJunction(publishableKey)

This method returns an instance of the PayJunction SDK object. You can access all other PayJunction SDK methods through this object.

A valid publishable key is required to call this method. Test and Production environments use different publishable keys, so remember to replace the test key with the production key before going live.

Method Parameters

Required Name Format Description
* publishableKey string A valid publishable key.

Returns

  • PayJunction - A PayJunction SDK instance.

Example Usage

var payjunction = PayJunction('YOUR_PUBLISHABLE_KEY');

Tokens

payjunction.createToken(paymentData)

Use payJunction.createToken to transform sensitive payment information into a single-use token. A token is represented by a token id. You can safely pass the token id to your server and use it with the PayJunction API.

Method Parameters

Required Name Format Description
* paymentData object An object containing sensitive payment information. It can be Card or ACH.

PaymentData Properties - Card

Required Name Format Description
* cardNumber string The credit card number used for payment.
* cardExpMonth string, 1-12 The credit card expiration month.
* cardExpYear string, 2 or 4 digits The credit card expiration year.
  cardCvv string, 3 or 4 digits The credit card verification value.

PaymentData Properties - ACH

Required Name Format Description
* achRoutingNumber string The ACH Routing Number.
* achAccountNumber string, between 4 and 17 digits The ACH Account Number.
* achAccountType string, "CHECKING" | "SAVINGS"

CHECKING - Checking Account

SAVINGS - Savings Account

Returns

  • Promise<TokenResponse|ErrorsResponse>.

payjunction.createToken returns a Promise which resolves with a result object. This object will be either:

  • A Token Response - A token was successfully created.
  • An Errors Response - An error occurred. Error responses follow the PayJunction API Error format.

Example Card Usage

payjunction.createToken({
cardNumber: '4444333322221111',
cardExpMonth: '12',
cardExpYear: '30',
cardCvv: '999'
})
.then(function(result) {
// Handle result.errors or result.tokenId
});

Example ACH Usage

payjunction.createToken({
achRoutingNumber: '104000016',
achAccountNumber: '12345',
achAccountType: 'CHECKING'
})
.then(function(result) {
// Handle result.errors or result.tokenId
});

Example Token Response

{
"tokenId" : "nX83miVXaCz5HvGSKufnow"
}

Example Errors Response

{
"errors" : [ {
"message" : "This field is required.",
"parameter" : "cardExpMonth",
"type" : "required"
}, {
"message" : "This field is required.",
"parameter" : "cardExpYear",
"type" : "required"
}, {
"message" : "This field is required.",
"parameter" : "cardNumber",
"type" : "required"
} ]
}

Token Response

Field Type Description
tokenId string

Random sequence of characters representing the payment details.

No sensitive information can be extracted from this string.

Browser Support

PayJunction SDK is supported on recent versions of all major browsers. We do not support Internet Explorer.