Skip to content

Last updated: January 25, 2023

Information

To learn more, reach out to your Customer Success Manager or support@checkout.com.

Model

Gateway

Payment flow

Redirect

Payment method type

Buy Now Pay Later

One-step payment

check

Capture

error

Refund

check

Partial refund

check

Return

error

Recurring payment

error

Tamara payments follow a 2-step process:

  1. Request a payment
  2. Redirect the customer

Request a payment

For the full API specification, see the API reference.

post

https://api.checkout.com/payments

Request example

1
{
2
"amount": 10000,
3
"currency": "SAR",
4
"source": {
5
"type": "tamara",
6
"billing_address": {
7
"address_line1": "123 Example St.",
8
"address_line2": "Apt. 456",
9
"city": "Riyadh",
10
"state": "Riyadh",
11
"zip": "96522",
12
"country": "SA"
13
}
14
},
15
"failure_url": "https://example.com/payments/failure",
16
"success_url": "https://example.com/payments/success",
17
"reference": "ORD-5023-4E89",
18
"customer": {
19
"name": "John Smith",
20
"email": "john.smith@example.com",
21
"phone": {
22
"country_code": "+966",
23
"number": "123456789"
24
}
25
},
26
"shipping": {
27
"address": {
28
"address_line1": "123 Example St.",
29
"address_line2": "Apt. 456",
30
"city": "Riyadh",
31
"state": "Riyadh",
32
"zip": "96522",
33
"country": "SA"
34
}
35
},
36
"processing": {
37
"tax_amount": 0,
38
"shipping_amount": 0
39
},
40
"items": [
41
{
42
"name": "Item 1",
43
"quantity": 2,
44
"unit_price": 2500,
45
"total_amount": 5000,
46
"tax_amount": 0,
47
"discount_amount": 0,
48
"reference": "Item 1 description",
49
"image_url": "https://example1_s3bucket.com",
50
"url": "https://example.website.com/item1",
51
"sku": "123687000111"
52
},
53
{
54
"name": "Item 2",
55
"quantity": 2,
56
"unit_price": 2500,
57
"total_amount": 5000,
58
"tax_amount": 0,
59
"discount_amount": 0,
60
"reference": "Item 2 description",
61
"image_url": "https://example2_s3bucket.com",
62
"url": "https://example.website.com/item2",
63
"sku": "123687000222"
64
}
65
]
66
}

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 in the following section.

1
{
2
"id": "pay_xee5o5lknkquxfwnipad5ys5xi",
3
"status": "Pending",
4
"reference": "ORD-5023-4E89",
5
"customer": {
6
"id": "cus_ujs5uvwcshhujllodxegkknwou",
7
"email": "john.smith@example.com",
8
"name": "John Smith",
9
"phone": {
10
"number": "123456789",
11
"country_code": "+966"
12
}
13
},
14
"processing": {
15
"partner_payment_id": "bb11115d-7fea-4727-9039-e20149abd9fe"
16
},
17
"_links": {
18
"self": {
19
"href": "https://api.sandbox.checkout.com/payments/pay_xee5o5lknkquxfwnipad5ys5xi"
20
},
21
"redirect": {
22
"href": "https://checkout-sandbox.tamara.co/checkout/fb026854-4839-4b4f-b94f-ee19eaab30a8?locale=en_US&orderId=bb11115d-7fea-4727-9039-e20149abd9fe&landing_variant=sharia_compliant&pay_the_difference=with_pay_the_difference_notes"
23
}
24
}
25
}

Redirect the customer

Redirect your customer to the redirect.href link 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
"id": "pay_xee5o5lknkquxfwnipad5ys5xi",
3
"requested_on": "2022-12-22T11:42:48.4619254Z",
4
"source": {
5
"type": "tamara"
6
},
7
"items": [
8
{
9
"name": "Item 1",
10
"quantity": 2,
11
"unit_price": 2500,
12
"reference": "Item 1 description",
13
"image_url": "https://example1_s3bucket.com",
14
"url": "https://example.website.com/item1",
15
"total_amount": 5000,
16
"tax_amount": 0,
17
"discount_amount": 0,
18
"sku": "123687000111"
19
},
20
{
21
"name": "Item 2",
22
"quantity": 2,
23
"unit_price": 2500,
24
"reference": "Item 2 description",
25
"image_url": "https://example2_s3bucket.com",
26
"url": "https://example.website.com/item2",
27
"total_amount": 5000,
28
"tax_amount": 0,
29
"discount_amount": 0,
30
"sku": "123687000222"
31
}
32
],
33
"amount": 10000,
34
"currency": "SAR",
35
"payment_type": "Regular",
36
"reference": "ORD-5023-4E89",
37
"status": "Pending",
38
"customer": {
39
"id": "cus_ujs5uvwcshhujllodxegkknwou",
40
"email": "john.smith@example.com",
41
"name": "John Smith",
42
"phone": {
43
"country_code": "+966",
44
"number": "123456789"
45
}
46
},
47
"shipping": {
48
"address": {
49
"address_line1": "123 Example St.",
50
"address_line2": "Apt. 456",
51
"city": "Riyadh",
52
"state": "Riyadh",
53
"zip": "96522",
54
"country": "SA"
55
}
56
},
57
"processing": {
58
"partner_payment_id": "bb11115d-7fea-4727-9039-e20149abd9fe"
59
},
60
"_links": {
61
"redirect": {
62
"href": "https://checkout-sandbox.tamara.co/checkout/fb026854-4839-4b4f-b94f-ee19eaab30a8?locale=en_US&orderId=bb11115d-7fea-4727-9039-e20149abd9fe&landing_variant=sharia_compliant&pay_the_difference=with_pay_the_difference_notes"
63
},
64
"self": {
65
"href": "https://api.sandbox.checkout.com/payments/pay_xee5o5lknkquxfwnipad5ys5xi"
66
},
67
"actions": {
68
"href": "https://api.sandbox.checkout.com/payments/pay_xee5o5lknkquxfwnipad5ys5xi/actions"
69
}
70
}
71
}

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
"amount": 100
3
}

Response example

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

Cancel a payment

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

To void a payment in progress, wait for the 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 and accepted by Checkout.com.

payment_capture_pending

Sent when a payment request is accepted by the payment provider (Tamara).

payment_expired

Sent when the payment has expired or was canceled by the customer.

payment_declined

Sent when a payment request has been rejected.

payment_captured

Sent when the payment has been successfully captured.

payment_refund_pending

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.