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.

Process a PayPal payment

PayPal payments follow a two-step process:

  1. Request a PayPal payment
  2. Redirect the customer

Step 1: Request a PayPal payment

The request

Use the details below to set up your request.

Endpoint live

https://api.checkout.com/payments

Endpoint sandbox

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

Header parameters

Header
Value

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 name
Description

amount
Integer
required

The payment amount.

currency
String
required

The three-letter ISO 4217 currency 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, .jpg or .png, and host the image on a secure (https) server. Character limit: 127 alphanumeric characters. Width: 190px. Height: 60px.

source.stc
String
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 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"
    }
  }
}

Step 2: 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 PayPal 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 request

Use the details below to set up your request.

Endpoint

Live

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

Sandbox

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

Header and path parameters

Header
Value

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

Path
Value

payment_id
Required

The payment ID, found in the payment response, or the session ID from the success/failure URL.

The 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 "Confirm".

  4. You should then be redirected to your predefined success URL.

Can we help?

Thanks for using Checkout.com. If you need any help or just have a question, please get in touch with our support team at support@checkout.com.

PayPal


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.