QPay

Start accepting payments using QPay, a favorite payment method in Qatar.

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

Overview

QPay payments follow a two-step process:

  1. Request a QPay payment
  2. Redirect the customer

Request a payment

The POST 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

The table below describes the minimum recommended fields. You can find the full list, as well as complete request and response examples, in our API reference.

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). Set this to QAR.

source

OBJECT

REQUIRED

Details about the payment source.

source.type

STRING

REQUIRED

The type of payment source. Set this to qpay.

source.description

STRING

REQUIRED

A description of the transaction.

Maximum of 255 characters (after UTF-8 URL encoding).

source.language

STRING

OPTIONAL

The customer's preferred language (2-letter ISO code). Set this to either ar (Arabic) or en (English).

Defaults to en if not specified.

source.quantity

STRING

OPTIONAL

The quantity (minimum value of 1) of the purchased item.

Used for display purposes only; does not affect the total amount of the payment.

source.national_id

STRING

OPTIONAL

The national ID of the customer.

Maximum of 32 characters.


Request example

{
  "amount": 100,
  "currency": "QAR",
  "source": {
    "type": "qpay",
    "description": "QPay Demo Payment",
    "language": "en",
    "quantity": "1",
    "national_id": "070AYY010BU234M"
  }
}

The POST response

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

Response example

{
  "id": "pay_7eil5osdlcdehe62et5aihec4q",
  "status": "Pending",
  "customer": {
    "id": "cus_mydbq4wrfp3excwlexeefsv3be"
  },
  "_links": {
    "self": {
      "href": "https://api.sandbox.checkout.com/payments/pay_7eil5osdlcdehe62et5aihec4q"
    },
    "redirect": {
      "href": "https://sbapi.ckotech.co/qpay-external/redirect-to-qpay?pun=52h7saoi5edthll6ceec"
    }
  }
}

Redirect the customer

Redirect your customer to the redirect link’s href in the response. This will allow the customer to authorize the payment, before they are 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 and path 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_7eil5osdlcdehe62et5aihec4q",
  "requested_on": "2019-06-20T10:03:42Z",
  "source": {
    "type": "qpay",
    "description": "QPay Demo Payment"
  },
  "amount": 100,
  "currency": "QAR",
  "payment_type": "Regular",
  "status": "Captured",
  "approved": true,
  "risk": {
    "flagged": false
  },
  "customer": {
    "id": "cus_mydbq4wrfp3excwlexeefsv3be"
  },
  "_links": {
    "redirect": {
      "href": "https://sbapi.ckotech.co/qpay-external/redirect-to-qpay?pun=52h7saoi5edthll6ceec"
    },
    "self": {
      "href": "https://api.sandbox.checkout.com/payments/pay_7eil5osdlcdehe62et5aihec4q"
    },
    "actions": {
      "href": "https://api.sandbox.checkout.com/payments/pay_7eil5osdlcdehe62et5aihec4q/actions"
    },
    "refund": {
      "href": "https://api.sandbox.checkout.com/payments/pay_7eil5osdlcdehe62et5aihec4q/refunds"
    }
  }
}

Refund a payment

QPay supports both partial and full refunds. You can refund a payment through the Hub or by using the refund API.

Cancel a payment

If the customer fails to complete their payment, we will automatically void the payment and send a payment_expired webhook.

If the customer cancels their payment, we will send a payment_canceled webhook.

Testing QPay

To start testing, you'll need to:

  • create a test account, and
  • contact your Customer Success manager or Integrations engineer to activate QPay payments in the sandbox environment.
  1. Create a QPay transaction as above, following the redirect link in the response to QPay's website.
  2. Enter the following details:
    1. Card number4215 3755 0088 3243
    2. Card expiry date: 06 | 2020
  3. Click Continue.
  4. Enter a debit card pin – you can dial in any four- or six-digit number – and then click Pay. You 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.