Skip to content

Tamara Beta

Last updated: 3rd August 2022

To start accepting Tamara payments, please contact your Customer Success Manager.

Model

Gateway

Payment flow

Redirect

Payment method type

Buy Now Pay Later

One-step payment

Authorization

Capture

Refund

Partial refund

Return

Recurring payment


Tamara payments follow a 2-step process:


Request a payment

For the full API specification, see the API reference.

    post

    https://api.checkout.com/payments

    Request example

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    {
    "amount": 10000,
    "currency": "SAR",
    "source": {
    "type": "tamara",
    "billing_address": {
    "address_line1": "Cecilia Chapman",
    "address_line2": "711-2880 Nulla St.",
    "city": "Mankato",
    "state": "Mississippi",
    "zip": "96522",
    "country": "SA"
    }
    },
    "failure_url": "https://example.com",
    "success_url": "https://example.com",
    "reference": "ORD-5023-4E89",
    "processing_channel_id": "{{reverseapi-processing-channel-id}}",
    "customer": {
    "name": "Cecilia Chapman",
    "email": "c.chapman@example.com",
    "phone": {
    "country_code": "+966",
    "number": "113 496 0000"
    }
    },
    "shipping": {
    "address": {
    "address_line1": "Cecilia Chapman",
    "address_line2": "711-2880 Nulla St.",
    "city": "Mankato",
    "state": "Mississippi",
    "zip": "96522",
    "country": "SA"
    }
    },
    "capture_on": "2019-09-10T10:11:12Z",
    "capture": true,
    "processing": {
    "tax_amount": 500,
    "shipping_amount": 1000
    },
    "items": [{
    "name": "Item name",
    "quantity": 3,
    "unit_price": 100,
    "total_amount": 100,
    "tax_amount": 19,
    "discount_amount": 2,
    "reference": "some description about item",
    "image_url": "https://some_s3bucket.com",
    "url": "https://some.website.com/item",
    "sku": "123687000111"
    }]
    }

    Response example

    If you receive a 202 Accepted response, with the status field set to Pending, your request was successful. You now need to redirect your customer as described below.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    {
    "id": "pay_i52fzvylcmxuhp3xluedyjuu54",
    "status": "Pending",
    "reference": "ORD-5023-4E89",
    "customer": {
    "id": "cus_ujs5uvwcshhujllodxegkknwou",
    "email": "c.chapman@example.com",
    "name": "Cecilia Chapman",
    "phone": {
    "number": "113 496 0000",
    "country_code": "+966"
    }
    },
    "_links": {
    "self": {
    "href": "https://api.checkout.sandbox.com/payments/pay_i52fzvylcmxuhp3xluedyjuu54"
    },
    "redirect": {
    "href": "https://checkout-sandbox.tamara.co/checkout/6ef74bd9-b05b-4d40-83e6-9ac5cd76d537?locale=en_US&orderId=95d520d8-94e0-424e-baaa-c8df0b1180e0"
    }
    }
    }

    Redirect the customer

    Redirect your customer to the redirect link 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

    Retrieve details about an existing Tamara payment with the following endpoints.

    For the full API specification, see the API reference.

      get

      https://api.checkout.com/payments/{id}

      Response example

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      47
      48
      49
      50
      51
      52
      53
      54
      55
      56
      57
      58
      59
      60
      {
      "id": "pay_i52fzvylcmxuhp3xluedyjuu54",
      "requested_on": "2022-01-14T09:57:49.1976636Z",
      "source": {
      "type": "tamara",
      "partner_payment_id": "95d520d8-94e0-424e-baaa-c8df0b1180e0"
      },
      "amount": 10000,
      "currency": "SAR",
      "payment_type": "Regular",
      "reference": "ORD-5023-4E89",
      "customer": {
      "id": "cus_ujs5uvwcshhujllodxegkknwou",
      "email": "c.chapman@example.com",
      "name": "Cecilia Chapman",
      "phone": {
      "number": "113 496 0000",
      "country_code": "+966"
      }
      },
      "shipping": {
      "address": {
      "address_line1": "Cecilia Chapman",
      "address_line2": "711-2880 Nulla St.",
      "city": "Mankato",
      "state": "Mississippi",
      "zip": "96522",
      "country": "SA"
      }
      },
      "payment_ip": "90.197.169.245",
      "status": "Pending",
      "processing": {
      "tax_amount": 500,
      "shipping_amount": 1000
      },
      "items": [{
      "name": "Item name",
      "quantity": 3,
      "unit_price": 100,
      "reference": "some description about item",
      "image_url": "https://some_s3bucket.com",
      "url": "https://some.website.com/item",
      "total_amount": 100,
      "tax_amount": 19,
      "discount_amount": 2,
      "sku": "123687000111"
      }],
      "_links": {
      "redirect": {
      "href": "https://checkout-sandbox.tamara.co/checkout/6ef74bd9-b05b-4d40-83e6-9ac5cd76d537?locale=en_US&orderId=95d520d8-94e0-424e-baaa-c8df0b1180e0"
      },
      "self": {
      "href": "https://api.checkout.sandbox.com/payments/pay_i52fzvylcmxuhp3xluedyjuu54"
      },
      "actions": {
      "href": "https://api.checkout.sandbox.com/payments/pay_i52fzvylcmxuhp3xluedyjuu54/actions"
      }
      }
      }

      Refund a payment

      Tamara supports both partial and full refunds. You can refund a payment through the Dashboard or by using the Refund API.

      For the full API specification, see the API reference.

        post

        https://api.checkout.com/payments/{id}/refunds

        Request example

        1
        2
        3
        {
        "amount": 100
        }

        Response example

        1
        2
        3
        4
        5
        6
        7
        8
        {
        "action_id": "act_2zhdyofygycezfjfmqh4iiujoa",
        "_links": {
        "payment": {
        "href": "https://api.checkout.sandbox.com/payments/pay_zt7jpwxhl2werecz2wvfourfya"
        }
        }
        }

        Cancel a payment

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

        To void a payment in progress, please wait for payment_captured webhook, and then process a refund. Communicating this in advance to your end customer can help you avoid chargebacks.


        Webhooks

        When using Tamara, you may receive the following webhooks.

        WebhookDescription

        payment_pending

        Sent when a payment request has been successfully initiated.

        payment_expired

        Sent when the payment has expired.

        payment_declined

        Sent when a payment request has been rejected.

        payment_capture_pending

        Sent when a customer has successfully completed the redirect checkout flow.

        payment_captured

        Sent when the payment has been successfully captured.

        payment_refund_accepted

        Sent when the refund of the payment has been (fully or partially) accepted.

        payment_refunded

        Sent when the payment has been (fully or partially) refunded.

        payment_refund_declined

        Sent when a refund has been declined.


        Testing Tamara

        To start testing, contact your Customer Success Manager or Integrations Engineer to activate Tamara payments in the sandbox environment.

        1. Create a Tamara transaction and select the redirect link in the response to Tamara’s website.
        2. Sign in to the account by filling up one of the test phone numbers you have been provided with.
        3. Confirm the OTP code – it should be pre-filled for you in the sandbox environment.
        4. Fill in the card details using test details.
        5. Select Submit. You should then be redirected to your predefined success URL.