QPay

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

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

Process a QPay payment

QPay payments follow a two-step process:

  1. Request a QPay payment
  2. Redirect the customer

Step 1: Request a QPay payment

The request

Use the following details to set up your payment request.

Endpoints

Live

https://api.checkout.com/payments

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

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

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
Integer
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 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"
    }
  }
}

Step 2: 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 QPay 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_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 QPay payment

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

Cancel a QPay 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:
      -   Card number: 4215 3755 0088 3243
      -   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".

  5. 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.

QPay


Suggested Edits are limited on API Reference Pages

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