PayPal

Start accepting PayPal payments and open your business to thousands of online shoppers.

To start accepting PayPal payments, please contact your customer success manager.

Overview

PayPal payments follow a two-step process:

  1. Request a PayPal payment
  2. Redirect the customer

Request a payment 

The POST request

Use the details below to set up your request.

Endpoints

https://api.checkout.com/payments
https://api.sandbox.checkout.com/payments

Header parameters

HeaderValue

Authorization

REQUIRED

secret key

Use the valid secret key of your Checkout.com account. You can find this in the Hub.

Content-Type

REQUIRED

application/json

Body parameters

Field nameDescription

amount

INTEGER

REQUIRED

The payment amount.

currency

STRING

REQUIRED

The currency in which the payment is being made (three-letter ISO 4217 code).

source

OBJECT

REQUIRED

Details about the payment source.

source.type

STRING

REQUIRED

The type of payment source. Set this to paypal.

source.invoice_number

STRING

REQUIRED

Your unique internal invoice number or tracking ID.

Using the same value in the optional reference field will help you match up the transactions across your Hub and PayPal accounts.

source.recipient_name

STRING

OPTIONAL

The full name of the shipment's recipient, if applicable.

If provided, the shipping.address field becomes required.

source.logo_url

STRING

OPTIONAL

The URL for your logo. Your logo will appear at the top of the cart review area.

Use a graphic file format, such as .gif, .jpeg or .png, and host the image on a secure (https) server. Character limit: 127 alphanumeric characters. Width: 190px. Height: 60px.

source.stc

OBJECT

OPTIONAL

These details are used by PayPal to perform a pre-transaction risk management evaluation. The property names should match those you agreed with PayPal.

Request example

{
  "amount": 100,
  "currency": "EUR",
  "source": {
    "type": "paypal",
    "invoice_number": "CKO00001",
    "logo_url": "https://www.example.com/logo.jpg",
    "stc": {
      "property_name1": "property 1",
      "property_name2": "property 2",
      "property_name3": "property 3"
    }
  }
}

The POST response

If you receive a 202 Success response containing a status field set to Pending, your request was successful.

Response example

{
  "id": "pay_ks2zlgzmff7ejnbvkpdw5n4liq",
  "status": "Pending",
  "customer": {
    "id": "cus_ho2i3q5rgl4e7ed3uox4ez4a5m"
  },
  "_links": {
    "self": {
      "href": "https://api.sandbox.checkout.com/payments/pay_ks2zlgzmff7ejnbvkpdw5n4liq"
    },
    "redirect": {
      "href": "https://www.sandbox.paypal.com/checkoutnow?token=EC-45B75666L8055651R&useraction=commit"
    }
  }
}

Redirect the customer 

Redirect your customer to the redirect link’s href in the response. The customer will be redirected to a PayPal page where they can authorize the payment, before being transferred to your predefined success or failure URL.

Get details about a payment

You can use the payment_id found in the payment response, or the cko-session-id from the success/failure URL (e.g., https://www.checkout.com/order/succeeded?cko-session-id=sid_vii64oquze5u3h2x6hh4rurc4y) to retrieve details about the payment.

The cko-session-id expires 15 minutes after being created.

The GET request

Use the details below to set up your request.

Endpoints

GEThttps://api.checkout.com/payments/{payment_id}
GEThttps://api.sandbox.checkout.com/payments/{payment_id}

Header parameters

HeaderValue

Authorization

REQUIRED

secret key

Use the valid secret key of your Checkout.com account. You can find this in the Hub.

Content-Type

REQUIRED

application/json
PathValue

payment_id

REQUIRED

The payment ID found in the response of the initial response

The GET response

Response example

{
  "id": "pay_ks2zlgzmff7ejnbvkpdw5n4liq",
  "requested_on": "2019-07-17T07:24:12Z",
  "source": {
    "type": "paypal"
  },
  "amount": 100,
  "currency": "EUR",
  "payment_type": "Regular",
  "status": "Captured",
  "approved": true,
  "risk": {
    "flagged": false
  },
  "customer": {
    "id": "cus_ho2i3q5rgl4e7ed3uox4ez4a5m"
  },
  "_links": {
    "self": {
      "href": "https://api.sandbox.checkout.com/payments/pay_ks2zlgzmff7ejnbvkpdw5n4liq"
    },
    "actions": {
      "href": "https://api.sandbox.checkout.com/payments/pay_ks2zlgzmff7ejnbvkpdw5n4liq/actions"
    },
    "refund": {
      "href": "https://api.sandbox.checkout.com/payments/pay_ks2zlgzmff7ejnbvkpdw5n4liq/refunds"
    }
  }
}

Testing PayPal

To start testing, you'll need to:

  • create a test account, and
  • contact your Customer Success manager or integrations engineer to activate PayPal payments in the sandbox environment.
  1. Create a PayPal transaction as above, following the redirect link in the response to PayPal's website.
  2. Log in with your PayPal username and password.
  3. Set the payment status – pending, paid, or refused – and then click ConfirmYou should then be redirected to your predefined success URL.


Can we help?

Thanks for using Checkout.com. If you need help or have a question, message our Support team at support@checkout.com.