Skip to main content

Sending API requests

The gateway API is a REST API that sends and receives JSON over HTTPS. This guide walks you through authenticating, making a first request in the sandbox, and confirming the result.

Note

You'll need sandbox credentials first. If you don't have them yet, create a developer account.

Step 1: Authentication

Every request is authenticated with HTTP Basic authentication. Use your merchant alias as the username and your secret key as the password.

  • Send requests from your server only. Never put the secret key in browser or mobile app code.
  • Use the sandbox address for testing and the production address only after certification. Both are provided with your credentials.
  • Always send requests over HTTPS.
Authorization header (example)
Authorization: Basic base64(<merchant_alias>:<secret_key>)
Content-Type: application/json
Accept: application/json

Step 2: Send a request to create a customer

A good first call is creating a customer record (called a shopper in the API). It needs no card data, so it's a safe way to confirm your credentials work.

Request (sandbox)
POST https://<sandbox-api-host>/shoppers
{
  "fullName": "Jordan Lee",
  "email": "jordan@example.com",
  "primaryAddress": {
    "street1": "100 Main St",
    "city": "Columbus",
    "postalCode": "43215",
    "countryCode": "USA"
  }
}

A successful response returns the new customer's id and href. Keep the href: you use it to attach stored cards and to reference the customer in later transactions.

Warning

If you get a 401 response, check that you're using the sandbox address with sandbox keys, and that the merchant alias and secret key aren't swapped.

Step 3: View the customer in the merchant portal

  1. 1Sign in to the merchant portal with the login sent with your sandbox account.
  2. 2Open Customers from the main menu.
  3. 3Find the customer you just created. API shoppers appear as customers in the portal.

Step 4: Start coding

Pick a starting point based on the integration you chose. Sample code for each quickstart comes with your sandbox access.

Redirect quickstart

Send shoppers to a hosted payment page. Node.js sample code.

View quickstarts

Lightbox quickstart

Open the hosted payment form in a pop-up over your checkout.

View quickstarts

Hosted fields quickstart

Embed secure card fields in your own checkout form.

View quickstarts

Direct integration

Build a fully custom payment experience with the API.

Direct API guide

Test your integration

Test cards, amounts, and how to trigger each kind of decline.

Testing guide

Gateway services in this section are provided through ONKORE's processing partner, Elavon. Developer accounts, sandbox and production credentials, the developer portal, and the merchant portal are provided by Elavon, so you'll see the Elavon name in those emails, portals, and API addresses. ONKORE remains your point of contact.