docs
Sandbox
Live

Reference » Merchant API Reference » Introduction

Introduction

Checkout.com's Merchant API uses HTTP verbs and a RESTful structure. This reference introduces the various concepts around online payments and describes the usage of all endpoints that make up the API, along with data structure, error messages and supported message formats.

We have code examples in Shell and Java (PHP and C# coming soon) and provide the following API libraries on Github.com to simplify your integration with Checkout.com's Merchant API:


Authentication

All API requests must be made over HTTPS. Requests made over HTTP will fail.

To initiate a request to any of Checkout.com’s endpoints, the 'Authorization' field of your HTTPS header request must include either your public key (PK) or secret key (SK). Use your SK for server-to-server requests and your PK for requests initiated from the client side. All examples included in our documentation will indicate which key to use.

Example Header Request

curl "https://API_endpoint_here"
-H "Authorization: pk_test_6ff46046-30af-41d9-bf58-929022d2cd14"

The API keys provided to you can be used in either Sandbox or Live mode. Remember that a different set of keys is required for each business channel.


Request and Response Format

Checkout.com's Merchant API supports content negotiation, meaning you can specify the format of your requests (JSON or XML) and your responses (JSON or XML).

The examples below illustrate how to send and receive requests and responses in the same format. However, it is also possible to send a JSON request and receive an XML response, or vice versa.

JSON

To send a JSON payload to the server and receive a JSON response, set the header to Content-Type:application/json and Accept:application/json, as specified in the example below.

Example Request

curl https://sandbox.checkout.com/api2/v2/tokens/payment
    -H "Authorization: sk_test_55aedccc-7f53-4ccc-b0a6-d943decc3c31"
    -H "Content-Type:application/json;charset=UTF-8"
    -H "Accept:application/json"
    -X POST
    -d '{"value":"2867", "currency":"USD", "chargeMode": "1"}'

Example Response

{
      "id": "pay_tok_5a010daa-4a30-4171-a8e9-8ae0c6de1c68",
      "liveMode": false
}

XML

To send a XML payload to the server and receive a XML response, set the header to Content-Type:application/xml and Accept:application/xml, as specified in the example below.

Example Request

curl https://sandbox.checkout.com/api2/v2/tokens/card
    -H "Authorization: pk_test_6ff46046-30af-41d9-bf58-929022d2cd14"
    -H "Content-Type:application/xml;charset=UTF-8"
    -H "Accept:application/xml"
    -X POST
    -d '<data>
            <value>2326</value>
            <currency>USD</currency>
            <chargeMode>1</chargeMode>
        </data>'

Example Response

<data xmlns:json="http://www.checkout.com/apis/json">
    <id>pay_tok_F445293C-CB60-4A9F-90ED-85374E164DEF</id>
    <liveMode>false</liveMode>
</data>