Tamara Beta
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.
https://api.checkout.com/payments
Request example
{"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.
{"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.
https://api.checkout.com/payments/{id}
Response example
{"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.
https://api.checkout.com/payments/{id}/refunds
Request example
{"amount": 100}
Response example
{"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.
Webhook | Description |
---|---|
| Sent when a payment request has been successfully initiated. |
| Sent when the payment has expired. |
| Sent when a payment request has been rejected. |
| Sent when a customer has successfully completed the redirect checkout flow. |
| Sent when the payment has been successfully captured. |
| Sent when the refund of the payment has been (fully or partially) accepted. |
| Sent when the payment has been (fully or partially) refunded. |
| 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.
- Create a Tamara transaction and select the redirect link in the response to Tamara’s website.
- Sign in to the account by filling up one of the test phone numbers you have been provided with.
- Confirm the OTP code – it should be pre-filled for you in the sandbox environment.
- Fill in the card details using test details.
- Select Submit. You should then be redirected to your predefined success URL.