Developers

A payments API built for builders.

49 endpoints across purchases, payouts, billing, subscriptions and webhooks. Bearer-token auth, signed callbacks, fully documented schemas. Ship in a weekend.

Endpoints
49
Resources
11
OpenAPI
3.0.0
curl -X POST "https://gate.safari.tech/api/v1/purchases/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "client": { "email": "client@example.com" },
    "purchase": {
      "products": [{ "name": "Pro plan", "price": 4900 }],
      "currency": "EUR"
    },
    "brand_id": "409eb80e-3782-4b1d-afa8-b779759266a5"
  }'

Create a Purchase, get a checkout_url, redirect your customer. That’s the whole flow.

REST, signed, predictable

JSON in, JSON out. Bearer-token auth, idempotent operations, asymmetric callback signing.

Webhooks with retries

Up to 9 delivery attempts over 36 hours, sequential per object, signed with X-Signature.

PCI-DSS scoped down

Direct Post + Server-to-Server flows keep card data out of your stack.

Plug-and-play modules

Drop-in connectors for WooCommerce, Magento, OpenCart, PrestaShop and more.

Getting started

Three things to know.

Read these once and the rest of the reference will feel familiar.

01

Authenticate with your API key

Pass your secret key as a Bearer token in the Authorization header of every request. Get one in your dashboard’s Developers section.

02

Use the same base URL everywhere

All endpoints below have a prefix of https://gate.safari.tech/api/v1/ — e.g. POST https://gate.safari.tech/api/v1/purchases/.

03

Subscribe to webhooks for state

Don’t poll. Register webhooks for events like purchase.paid and verify the X-Signature RSA header against your callback public key.

API ReferenceJump to resource
Resource

Purchases

10 endpoints

post/purchases/

Create a purchase – the main request for any e-commerce integration.

To run payments in your application use `POST /purchases/`, request to register payments and receive the checkout link (`checkout_url`). After the payment is processed, gateway will redirect the client back to your website (take note of `success_redirect`, `failure_redirect`). You have three options to check payment status: 1) use `success_callback` parameter of `Purchase` object; 2) use `GET /purchases/<purchase_id>/` request; 3) set up a Webhook using the UI or Webhook API to listen to `purchase.paid` or `purchase.payment_failure` event on your server. Using `skip_capture` flag allows you…

Request body

clientClientDetailsrequired

Either this or `.client_id` is required.

Show child attributes
emailEmailrequired

Email address

phonePhone

Phone number in the `<country_code> <number>` format

full_namestring

Name and surname of client

personal_codestring

Personal identification code of client

street_addressStreetAddress

Street house number and flat address where applicable

countryCountry

Country code in the ISO 3166-1 alpha-2 format (e.g. 'GB')

cityCity

City name

zip_codeZIPCode

ZIP or postal code

stateState

State code

shipping_street_addressStreetAddress

Street house number and flat address where applicable

shipping_countryCountry

Country code in the ISO 3166-1 alpha-2 format (e.g. 'GB')

shipping_cityCity

City name

shipping_zip_codeZIPCode

ZIP or postal code

shipping_stateState

State code

ccarray<Email>

Email addresses to receive a carbon copy of all notification emails

bccarray<Email>

Email addresses to receive a blind carbon copy of all notification emails

legal_namestring

Legal name of company

brand_namestring

Company brand name

registration_numberstring

Registration number of company

tax_numberstring

Tax payer registration number

delivery_methodsarray<object>

List of delivery methods for invoices

Show child attributes
methodenumrequired

The method of invoice delivery

emailtext_message
optionsobjectrequired

Additional options for the delivery method

purchasePurchaseDetailsrequired

Core information about the Purchase, including the products, total, currency and invoice fields. If you're using invoicing via `/billing/` or `/billing_templates/`, this object will be copied 1:1 from BillingTemplate you specify to the resulting Purchases (also to subscription Purchases).

Show child attributes
currencyCurrency

Currency code in the ISO 4217 standard (e.g. 'EUR'). Default currency is `EUR`.

productsarray<Product>required

Line items of the invoice. In case of a transaction with no invoice sent, specify a single Product forming the cost of transaction.

Show child attributes
namestringrequired

Product name

quantitystring<float>

Quantity of these products in invoice

priceMoneyAmountrequired

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY. You can use this field or `total_override` with a value of 0 to activate preauthorization scenario. See the description of the `Purchase.skip_capture` field.

discountMoneyAmount

Total discount per this product in invoice

tax_percentstring<float>

Percent of tax added to the price of this product

categorystring

Product category

total_price_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

totalMoneyAmountread-only

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

languagestring<ISO 639-1>

Language code in the ISO 639-1 format (e.g. 'en'). Supported values: `az`, `de`, `en`, `en-GB`, `es`, `et`, `fr`, `it`, `lt`, `lv`, `pt`, `pt-BR`, `ru`, `tr`, `uk`.

notesstring
debtMoneyAmount

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

subtotal_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

total_tax_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

total_discount_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

total_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

request_client_detailsarray<enum>

ClientDetails fields to request from the client before the payment. If a value is passed for a field in ClientDetails, it will be automatically removed from this list.

timezonestring<TZ database name>

Timezone to localize invoice-specific timestamps in, e.g. to display a concrete date for a `due` timestamp on the invoice.

due_strictboolean

Whether to permit payments when Purchase's `due` has passed. By default those are permitted (and status will be set to `overdue` once `due` moment is passed). If this is set to `true`, it won't be possible to pay for an overdue invoice, and when `due` is passed the Purchase's status will be set to `expired`.

email_messagestringread-only

An optional message to display to your customer in invoice email, e.g. "Your invoice for June".

metadataobject

Custom information with maximum length of 10000 characters

single_attemptboolean

When set to true, prevents retry attempts if the payment fails. The purchase will be immediately marked as cancelled upon failure, and the payer will not see a retry button on the failure page. If not provided, inherits the value from the Company's `single_attempt` setting.

paymentPaymentDetailsread-onlynullable

Details of an executed transaction. Read-only for `Purchase`s and `Payout`s. For an unpaid `Purchase`, this object will be `null`.

Show child attributes
is_outgoingboolean

Denotes the direction of payment, e.g. for a paid Purchase, is granted to be `false`, `true` for payouts.

payment_typeenumread-only
purchasepurchase_chargepayoutbank_paymentrefundcustom
amountMoneyAmount

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

currencyCurrency

Currency code in the ISO 4217 standard (e.g. 'EUR'). Default currency is `EUR`.

net_amountMoneyAmountread-only

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

fee_amountMoneyAmountread-only

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

pending_amountMoneyAmountread-only

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

pending_unfreeze_onUnixTimestampread-onlynullable
descriptionstring
paid_onUnixTimestampread-only

When the payment was accepted in (`is_outgoing == false`) or sent from (`is_outgoing == true`) the gateway system.

remote_paid_onUnixTimestampread-only

If available, this field will report the date the payment was sent by the remote payer (`is_outgoing == false`) or when funds arrived to the remote beneficiary (`is_outgoing == true`).

issuer_detailsIssuerDetailsread-only

Read-only details of issuer company/brand, persisted for invoice display.

Show child attributes
websiteURLread-only

Company website URL

legal_street_addressStreetAddressread-only

Street house number and flat address where applicable

legal_countryCountryread-only

Country code in the ISO 3166-1 alpha-2 format (e.g. 'GB')

legal_cityCityread-only

City name

legal_zip_codeZIPCoderead-only

ZIP or postal code

bank_accountsarray<BankAccountMixin>read-only
Show child attributes
bank_accountstring

Bank account number (e.g. IBAN)

bank_codestring

SWIFT/BIC code of the bank

legal_namestringread-only

Legal name of company

brand_namestringread-only

Company brand name

registration_numberstringread-only

Registration number of company

tax_numberstringread-only

Tax payer registration number

transaction_dataobjectread-only

Payment method-specific, read-only transaction data. Will contain information about all the transaction attempts and possible errors, if available.

Show child attributes
payment_methodstring

Payment method used if Purchase was paid, blank string otherwise.

extraobject

Extra data associated with selected payment method if Purchase was paid, empty object otherwise. Dataset depends on payment method. E.g. for card payment methods like `visa` or `mastercard` it will contain properties `masked_pan: string`, `three_d_secure: boolean`, `expiry_month: int`, `expiry_year: int` and `cardholder_name: string`.

countrystring

Country code (in the ISO 3166-1 alpha-2 format e.g. 'GB') where payment tool used originates (e.g. in case of card payments, the card issuing country). Will be blank if Purchase was not paid or country could not be detected.

attemptsarray<object>

Will contain information about all the payment attempts made and errors encountered, if any.

Show child attributes
typeenum

Type of action attempted

executeauthorizereleasecapturerecurring_executedelete_recurring_tokenrefund
successfulboolean

If this attempt was successful or not. For `false`, `error` of this attempt will be not null.

payment_methodstring

Payment method used for this attempt.

extraobject

Extra data associated with selected payment method. Dataset depends on payment method. E.g. for card payment methods like `visa` or `mastercard` it will contain properties `masked_pan: string`, `three_d_secure: boolean`, `expiry_month: int`, `expiry_year: int` and `cardholder_name: string`.

countrystring

Country code (in the ISO 3166-1 alpha-2 format e.g. 'GB') where payment tool used originates (e.g. in case of card payments, the card issuing country). Will be blank if country could not be detected.

client_ipstring<IP>

IP the paying client made this attempt from, if available.

processing_timeUnixTimestamp

Time (if possible, fetched from the remot processing system) this attempt happened at.

errorobjectnullable

Code and description of the error encountered. Not-null if `successful` parameter of this attempt is `false`.

statusPurchaseStatusread-only

Purchase status. Can have the following values: `created`: Purchase was created using POST /purchases/ or Billing API capabilities. --- `sent`: Invoice for this purchase was sent over email using Billing API capabilities. --- `viewed`: The client has viewed the payform and/or invoice details for this purchase. --- `error`: There was a failed payment…

createdsentviewederrorcancelledoverdueexpiredholdreleasedpending_releasepending_capturepreauthorized+6 more
status_historyarray<any>read-only

History of status changes, latest last. Might contain entry about a related object, e.g. status change to `refunded` will contain a reference to the refund Payment.

Show child attributes
statusPurchaseStatusread-only

Purchase status. Can have the following values: `created`: Purchase was created using POST /purchases/ or Billing API capabilities. --- `sent`: Invoice for this purchase was sent over email using Billing API capabilities. --- `viewed`: The client has viewed the payform and/or invoice details for this purchase. --- `error`: There was a failed payment…

createdsentviewederrorcancelledoverdueexpiredholdreleasedpending_releasepending_capturepreauthorized+6 more
timestampUnixTimestamp
related_objectanynullable
Show child attributes
typestring
idstring<uuid>
viewed_onUnixTimestampread-onlynullable

Time the payment form or invoice page was first viewed on

company_idstring<uuid>read-only
is_testbooleanread-only

Indicates this is a test object, created using test API keys or using Billing section of UI while in test mode.

user_idstring<uuid>read-onlynullable

ID of user who has created this object in the Billing UI, if applicable.

brand_idstring<uuid>required

ID of the brand to create this Purchase for. You can copy it down in the API section, see the "specify the ID of the Brand" link in answer to "How to setup payments on website or in mobile app?".

billing_template_idstring<uuid>read-onlynullable

ID of a BillingTemplate that has spawned this Purchase, if any.

client_idstring<uuid>nullable

ID of a Client object used to initialize ClientDetails (`.client`) of this Purchase. Either this field or specifying `.client` object is required (you can only specify a value for one of these fields). All `ClientDetails` fields from the Client will be copied to `.client` object. Note that editing Client object won't change the respective fields in already c…

send_receiptboolean

Whether to send receipt email for this Purchase when it's paid.

is_recurring_tokenbooleanread-only

Indicates whether a recurring token (e.g. for card payments - card token) was saved for this Purchase. If this is `true`, the `id` of this Purchase can be used as a `recurring_token` in `POST /purchases/{id}/charge/`, enabling you to pay for that Purchase using the same method (same card for card payments) that this one was paid with.

recurring_tokenstring<uuid>read-onlynullable

ID of a recurring token (Purchase having `is_recurring_token == true`) that was used to pay this Purchase, if any.

skip_captureboolean

Card payment-specific: if set to true, only authorize the payment (place funds on hold) when payer enters his card data and pays. This option requires a `POST /capture/` or `POST /release/` later on. You can use the preauthorization feature if you set this parameter to true and make the Purchase with `purchase.total == 0` (this can be achieved by providing…

force_recurringboolean

If the used payment method supports recurring payment functionality, forces the customer's payment credentials to be saved for possible later recurring payments, without giving the customer a choice in the matter.

reference_generatedstringread-only

If you don't provide an invoice `reference` yourself, this autogenerated value will be used as a reference instead.

referencestring

Invoice reference.

issuedTimestampnullable

Value for 'Invoice issued' field. Display-only, does not get validated. If not provided, will be generated as the current date in `purchase.timezone` at the moment of Purchase's creation.

dueUnixTimestampnullable

When the payment is due for this Purchase. The default behaviour is to still allow payment once this moment passes. To change that, set `purchase.due_strict` to true.

refund_availabilityenumread-only

Specifies, if the purchase can be refunded fully and partially, only fully, partially or not at all.

allfull_onlypartial_onlypis_allpis_partialnone
refundable_amountMoneyAmountread-only

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

currency_conversionobjectread-onlynullable

This object is present when automatic currency conversion has occurred upon creation of the purchase. Purchase's original currency was changed and its original amount was converted using the exchange rate shown here.

Show child attributes
original_currencystringread-only

Currency this purchase was initially created with

original_amountintegerread-only

Amount this purchase was initially created with

exchange_ratenumberread-only

Exchanged rate that was used for currency conversion. Original amount was multiplied by this number to calculate the new purchase amount.

payment_method_whitelistarray<string>

An optional whitelist of payment methods availble for this purchase. Use this field if you want to restrict your payer to pay using only one or several specific methods. Using this field and at the same time trying to use specific capabilities of a Purchase (e.g. `skip_capture` or charging it using a saved card token using `POST /purchases/{id}/charge/`) c…

success_redirectURL

When Purchase is paid for successfully, your customer will be taken to this link. Otherwise a standard screen will be displayed.

failure_redirectURL

If there's a payment failure for this Purchase, your customer will be taken to this link. Otherwise a standard screen will be displayed.

cancel_redirectURL

If you provide this link, customer will have an option to go to it instead of making payment (a button with 'Return to seller' text will be displayed). Can't contain any of the following symbols: `<>'"` . Be aware that this does not cancel the payment (e.g. does not do the equivalent of doing the `POST /purchases/{id}/cancel/` request); the client will stil…

success_callbackURL

When Purchase is paid for successfully, the `success_callback` URL will receive a POST request with the Purchase object's data in body.

creator_agentstring

Identification of software (e.g. an ecommerce module and version) used to create this purchase, if any.

platformenum

Platform this Purchase was created on.

webapiiosandroidmacoswindows
productenumread-only

Defines which gateway product was used to create this Purchase.

purchasesbilling_invoicesbilling_subscriptionsbilling_subscriptions_invoice
created_from_ipstring<IP>read-only

IP the Purchase was created from.

invoice_urlURLread-onlynullable

URL you will be able to access invoice for this Purchase at, if applicable

checkout_urlURLread-only

URL you will be able to access the checkout for this Purchase at, if payment for it is possible. When building integrations, redirect the customer to this URL once purchase is created. You can add the `preferred` query arg to the `checkout_url` in order to force redirect the client straight to the checkout for a specific payment method (`?preferred={paymen…

direct_post_urlURLread-onlynullable

URL that can be used for Direct Post integration. This functionality is activated for each merchant account individually. Please consult with your account manager if you wish to use it. Will be null if payment for purchase is not possible, `purchase.request_client_details` isn't empty or success_redirect/failure_redirect are not provided - these all brea…

marked_as_paidbooleanread-only

True if a purchase was manually marked as paid.

order_idstringread-only

ID of corresponding order.

upsell_campaignsarray<string<uuid>>

Array of IDs of related Upsell campaigns.

referral_campaign_idstring<uuid>nullable

ID of Referral campaign.

referral_codestringread-only

Referral code used with purchase.

referral_code_generatedstringread-only

Referral code created by purchase.

referral_code_detailsobjectread-only

Referral code detailed information for purchase.

Show child attributes
campaign_idstring<uuid>read-only

Referral campaign ID.

reward_typeenumread-only

Reward type of applied Referral code.

giftdiscountmoney
discount_amountMoneyAmountread-only

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

discount_percentnumber<float>read-only

Discount percent of applied Referral code

retain_level_detailsobjectread-only

Retain level detailed information for purchase.

Show child attributes
campaign_idstring<uuid>read-only

Retain campaign ID.

discount_amountMoneyAmountread-only

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

discount_percentnumber<float>read-only

Discount percent of applied Retain level.

typestringread-only

Object type identifier

idstring<uuid>read-only
created_onUnixTimestampread-only

Object creation time

updated_onUnixTimestampread-only

Object last modification time

Response · 201

OK

curl -X POST "https://gate.safari.tech/api/v1/purchases/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "client": {
      "email": "test@test.com"
    },
    "purchase": {
      "products": [
        {
          "name": "test",
          "price": 100
        }
      ]
    },
    "brand_id": "409eb80e-3782-4b1d-afa8-b779759266a5"
  }'
Response
{}
get/purchases/{id}/

Retrieve an object by ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/purchases/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{}
post/purchases/{id}/cancel/

Cancel a pending purchase.

If you have a Purchase that payment is possible for, using this request you can guarantee that it won't be paid.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 200

OK

curl -X POST "https://gate.safari.tech/api/v1/purchases/{id}/cancel/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{}
post/purchases/{id}/release/

Release funds on hold.

Release funds reserved for a Purchase (`status == hold`). You can place a `hold` (authenticate the payment) using `skip_capture == true` when creating the Purchase and ensuring your client submits the payment form. If this operation takes too long to be processed on the acquirer side - you will get a response with status code 200 and a Purchase object having `status` = `pending_release` in body (you will receive a corresponding Webhook callback too for a `purchase.pending_release` event). To be notified of a successful operation completion, please subscribe to `purchase.released` callback eve…

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 200

OK

curl -X POST "https://gate.safari.tech/api/v1/purchases/{id}/release/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{}
post/purchases/{id}/capture/

Capture a previously authorized payment.

Capture funds reserved for a Purchase (`status == hold`). You can place a `hold` (authenticate the payment) using `skip_capture == true` when creating the Purchase and ensuring your client submits the payment form. If this operation takes too long to be processed on the acquirer side - you will get a response with status code 200 and a Purchase object having `status` = `pending_capture` in body (you will receive a corresponding Webhook callback too for a `purchase.pending_capture` event). To be notified of a successful operation completion, please subscribe to `purchase.captured` callback eve…

Path parameters

idstring<uuid>required

Object ID (UUID)

Request body

amountinteger

Amount to be captured. Used to perform partial captures. Remainder will be automatically released.

Response · 200

OK

curl -X POST "https://gate.safari.tech/api/v1/purchases/{id}/capture/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 0
  }'
Response
{}
post/purchases/{id}/charge/

Charge or Hold a purchase using a saved token.

Charge or Hold a purchase using a `recurring_token` provided in the request body. Its value should be an `id` of a Purchase that has `is_recurring_token == true`. This purchase will be paid using the same method (e.g. same card) as the one used to pay the `recurring_token` purchase. The Hold will be performed if the Purchase this method is used on has `skip_capture`: `true`. If this operation takes too long to be processed on the acquirer side - you will get a response with status code 200 and a Purchase object having `status` = `pending_charge` in body (you will receive a corresponding Webho…

Path parameters

idstring<uuid>required

Object ID (UUID)

Request body

recurring_tokenstring<uuid>

ID of a recurring token (Purchase having `is_recurring_token == true`) to use.

Response · 200

OK

curl -X POST "https://gate.safari.tech/api/v1/purchases/{id}/charge/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "recurring_token": "ea582899-78ec-4c3a-9cb3-08f922e556b6"
  }'
Response
{}
post/purchases/{id}/delete_recurring_token/

Delete a recurring token associated with a purchase.

Will set `is_recurring_token` to `false`. You won't be able to use this Purchase's ID as a `recurring_token` anymore. The respective ClientRecurringToken, if any, will also be deleted. If this operation takes too long to be processed on the acquirer side - you will get a response with status code 200 a corresponding Webhook callback for a `purchase.pending_recurring_token_delete` event. To be notified of a successful operation completion, please subscribe to `purchase.recurring_token_deleted` callback event.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 200

OK

curl -X POST "https://gate.safari.tech/api/v1/purchases/{id}/delete_recurring_token/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{}
post/purchases/{id}/refund/

Refund a paid purchase.

Will generate a Payment object and return it as a successful response. Optional `amount` argument can be included in the request body to request a partial refund. Consult `refund_availability` field on Purchase on details whether this Purchase can be refunded or not. If this operation takes too long to be processed on the acquirer side - you will get a response with status code 200 and a Purchase object having `status` = `pending_refund` in body (you will receive a corresponding Webhook callback too for a `purchase.pending_refund` event). To be notified of a successful operation completion…

Path parameters

idstring<uuid>required

Object ID (UUID)

Request body

amountinteger

Amount to refund in minor units of the purchase's currency - e.g. `100` for €1.00. Should not be more than `Purchase.refundable_amount`. Optional; if not provided, a full refund will be executed. See the description for `Purchase.refund_availability` field.

referencestring

Optional custom reference for the refund.

Response · 200

OK

curl -X POST "https://gate.safari.tech/api/v1/purchases/{id}/refund/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 120,
    "reference": "REFUND-123"
  }'
Response
{}
post/purchases/{id}/mark_as_paid/

Mark a purchase as paid.

Will set the purchase's status to `paid`. `purchase.marked_as_paid` field will also be set to true to distinguish this purchase.

Path parameters

idstring<uuid>required

Object ID (UUID)

Request body

paid_onnumber

UTC timestamp at which this purchase was paid. Current time will be used if omitted.

Response · 200

OK

curl -X POST "https://gate.safari.tech/api/v1/purchases/{id}/mark_as_paid/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "paid_on": 1635162311
  }'
Response
{}
post/purchases/{id}/resend_invoice/

Re-sends invoice

Will re-send the invoice.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 200

OK

curl -X POST "https://gate.safari.tech/api/v1/purchases/{id}/resend_invoice/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{}
Resource

Payouts

2 endpoints

post/payouts/

Create an unprocessed payout object. A separate request is needed to execute the payout.

To issue payouts in your application use `POST /payouts/` request to register a payout. Response will contain the payout execution url - `execution_url`. For card payouts send a POST request to `execution_url` with a JSON payload containing recipient's card details: `expiry_month`: string; 1-2 digits `expiry_year`: string; 1-2 digits, `card_number`: string; 16-19 chars, `cardholder_name`: string; 1-30 chars. <br><br>For wallet payouts, please contact support to get specific details on how to send a POST request to execution_url.<br><br> You need to do the 2nd request within 15 minutes…

Request body

paymentPaymentDetailsrequired

Details of an executed transaction. Read-only for `Purchase`s and `Payout`s. For an unpaid `Purchase`, this object will be `null`.

Show child attributes
is_outgoingboolean

Denotes the direction of payment, e.g. for a paid Purchase, is granted to be `false`, `true` for payouts.

payment_typeenumread-only
purchasepurchase_chargepayoutbank_paymentrefundcustom
amountMoneyAmountrequired

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

currencyCurrencyrequired

Currency code in the ISO 4217 standard (e.g. 'EUR'). Default currency is `EUR`.

net_amountMoneyAmountread-only

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

fee_amountMoneyAmountread-only

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

pending_amountMoneyAmountread-only

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

pending_unfreeze_onUnixTimestampread-onlynullable
descriptionstring
paid_onUnixTimestampread-only

When the payment was accepted in (`is_outgoing == false`) or sent from (`is_outgoing == true`) the gateway system.

remote_paid_onUnixTimestampread-only

If available, this field will report the date the payment was sent by the remote payer (`is_outgoing == false`) or when funds arrived to the remote beneficiary (`is_outgoing == true`).

clientClientDetailsrequired

Contains details about the client of a purchase or payment - the remote payer/fund recipient party.

Show child attributes
emailEmailrequired

Email address

phonePhone

Phone number in the `<country_code> <number>` format

full_namestring

Name and surname of client

personal_codestring

Personal identification code of client

street_addressStreetAddress

Street house number and flat address where applicable

countryCountry

Country code in the ISO 3166-1 alpha-2 format (e.g. 'GB')

cityCity

City name

zip_codeZIPCode

ZIP or postal code

stateState

State code

shipping_street_addressStreetAddress

Street house number and flat address where applicable

shipping_countryCountry

Country code in the ISO 3166-1 alpha-2 format (e.g. 'GB')

shipping_cityCity

City name

shipping_zip_codeZIPCode

ZIP or postal code

shipping_stateState

State code

ccarray<Email>

Email addresses to receive a carbon copy of all notification emails

bccarray<Email>

Email addresses to receive a blind carbon copy of all notification emails

legal_namestring

Legal name of company

brand_namestring

Company brand name

registration_numberstring

Registration number of company

tax_numberstring

Tax payer registration number

delivery_methodsarray<object>

List of delivery methods for invoices

Show child attributes
methodenumrequired

The method of invoice delivery

emailtext_message
optionsobjectrequired

Additional options for the delivery method

transaction_dataobjectread-only

Payment method-specific, read-only transaction data. Will contain information about all the transaction attempts and possible errors, if available.

Show child attributes
payment_methodstring

Payment method used if Payout was paid, blank string otherwise.

extraobject

Extra data associated with selected payment method if Payout was paid, empty object otherwise. Dataset depends on payment method. E.g. for card payment methods like `visa` or `mastercard` it will contain properties `masked_pan: string`, `three_d_secure: boolean`, `expiry_month: int`, `expiry_year: int` and `cardholder_name: string`.

countrystring

Country code (in the ISO 3166-1 alpha-2 format e.g. 'GB') where payment tool used originates (e.g. in case of card payments, the card issuing country). Will be blank if Payout was not paid or country could not be detected.

attemptsarray<object>

Will contain information about all the payment attempts made and errors encountered, if any.

Show child attributes
successfulboolean

If this attempt was successful or not. For `false`, `error` of this attempt will be not null.

payment_methodstring

Payment method used for this attempt.

extraobject

Extra data associated with selected payment method. Dataset depends on payment method. E.g. for card payment methods like `visa` or `mastercard` it will contain properties `masked_pan: string`, `three_d_secure: boolean`, `expiry_month: int`, `expiry_year: int` and `cardholder_name: string`.

countrystring

Country code (in the ISO 3166-1 alpha-2 format e.g. 'GB') where payment tool used originates (e.g. in case of card payments, the card issuing country). Will be blank if country could not be detected.

client_ipstring<IP>

IP the paying client made this attempt from, if available.

processing_timeUnixTimestamp

Time (if possible, fetched from the remot processing system) this attempt happened at.

errorobjectnullable

Code and description of the error encountered. Not-null if `successful` parameter of this attempt is `false`.

reference_generatedstringread-only

If you don't provide an invoice `reference` yourself, this autogenerated value will be used as a reference instead.

referencestring

Payout reference.

statusPayoutStatusread-only

`Payout` status. Can have the following values: `initialized`: `Payout` was created, but not executed. Initial status to new `Payout`s. --- `pending`: `Payout`'s execution is currently pending --- `error`: An error has occurred during the execution. Execution can be attempted again. --- `success`: `Payout` was executed successfully.

initializedpendingerrorsuccess
status_historyarray<any>read-only

History of status changes, latest last.

Show child attributes
statusPayoutStatusread-only

`Payout` status. Can have the following values: `initialized`: `Payout` was created, but not executed. Initial status to new `Payout`s. --- `pending`: `Payout`'s execution is currently pending --- `error`: An error has occurred during the execution. Execution can be attempted again. --- `success`: `Payout` was executed successfully.

initializedpendingerrorsuccess
timestampUnixTimestamp
sender_namestring

Name of payout sender.

recipient_card_countrystringread-only

Recipient's card's registration country. Country code in the ISO 3166-1 alpha-2 format (e.g. `GB`).

recipient_card_brandstringread-only

Recipient's card's brand, e.g. `visa` or `mastercard`.

payout_method_whitelistarray<string>

An optional whitelist of payment methods availble for this Payout. Use this field if you want to restrict your payer to pay using only one or several specific methods.

execution_urlstringread-only

URL that must be used for payout execution. See details in description.

brand_idstring<uuid>required

ID of the brand to create this Payout for. You can copy it down in the API section, see the "specify the ID of the Brand" link in answer to "How to setup payments on website or in mobile app?".

issuer_detailsobjectread-only
Show child attributes
legal_namestringread-only

Legal name of company

brand_namestringread-only

Company brand name

company_idstring<uuid>read-only
is_testbooleanread-only

Indicates this is a test object, created using test API keys or using Billing section of UI while in test mode.

user_idstring<uuid>read-onlynullable

ID of user who has created this object in the Billing UI, if applicable.

typestringread-only

Object type identifier

idstring<uuid>read-only
created_onUnixTimestampread-only

Object creation time

updated_onUnixTimestampread-only

Object last modification time

Response · 201

OK

curl -X POST "https://gate.safari.tech/api/v1/payouts/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "client": {
      "email": "test@example.com"
    },
    "payment": {
      "amount": 10000,
      "currency": "EUR",
      "description": "This is a description"
    },
    "brand_id": "f025d78f-3d23-49d1-a377-e2bf7e318a25"
  }'
Response
{}
get/payouts/{id}/

Retrieve an object by ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/payouts/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{}
Resource

Billing

11 endpoints

post/billing/

Send an invoice to one or several clients.

Use this endpoint to send a one time invoice(-s). Provide all data of a `BillingTemplate` (see Schemas below) and, additionally, an array of one or more BillingTemplateClients in `clients`. Purchases will be created and invoices sent, one for every Client you have specified. A BillingTemplate won't be created; if you need to be able to issue repeated, similar invoices, see `POST /billing_templates/` and `POST /billing_templates/{id}/send_invoice/`. Note that unlike for other requests where you can send BillingTemplate data (like `POST /billing_templates/`), `title` and `is_subscription` ar…

Request body

clientsarray<BillingTemplateClient>required
Show child attributes
client_idstring<uuid>required

ID of the Client object to add to the BillingTemplate. Read-only after the BillingTemplateClient has been created. Note that the same Client can be added to a BillingTemplate several times.

number_of_billing_cycles_passedintegerread-only

Only used together with number_of_billing_cycles on BillingTemplate. Shows number of billing cycles passed when number of cycles is limited

invoice_referencestringnullable

When present overrides reference for invoices generated for this client

statusenum

For subscriptions, you can edit (`PATCH /billing_templates/{id}/clients/{id}/`) this status between `active` and `subscription_paused` values to pause the client's subscription. Paused subscriptions run as normal, except for purchases not being created and invoices sent for them. It means that if you pause a BillingTemplateClient's monthly subscription cycle…

pendinginactiveactivesubscription_paused
subscription_billing_scheduled_onTimestampread-onlynullable

If not null, reports the date when the next billing is scheduled for this client.

payment_method_whitelistarray<string>

An optional whitelist of payment methods availble for purchases generated for this BillingTemplateClient. Copied 1:1 to `Purchase.payment_method_whitelist` field on created Purchases (see its description).

send_invoice_on_charge_failureboolean

Sends invoice when subscription charge fails if this is `true`

send_invoice_on_add_subscriberboolean

Sends invoice when `POST /billing_templates/{id}/add_subscriber/` is called if this is `true`

send_receiptboolean

Sends receipt when subscription charge succeeds if this is `true`

typestringread-only

Object type identifier

idstring<uuid>read-only
created_onUnixTimestampread-only

Object creation time

updated_onUnixTimestampread-only

Object last modification time

purchasePurchaseDetailsrequired

Core information about the Purchase, including the products, total, currency and invoice fields. If you're using invoicing via `/billing/` or `/billing_templates/`, this object will be copied 1:1 from BillingTemplate you specify to the resulting Purchases (also to subscription Purchases).

Show child attributes
currencyCurrency

Currency code in the ISO 4217 standard (e.g. 'EUR'). Default currency is `EUR`.

productsarray<Product>required

Line items of the invoice. In case of a transaction with no invoice sent, specify a single Product forming the cost of transaction.

Show child attributes
namestringrequired

Product name

quantitystring<float>

Quantity of these products in invoice

priceMoneyAmountrequired

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY. You can use this field or `total_override` with a value of 0 to activate preauthorization scenario. See the description of the `Purchase.skip_capture` field.

discountMoneyAmount

Total discount per this product in invoice

tax_percentstring<float>

Percent of tax added to the price of this product

categorystring

Product category

total_price_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

totalMoneyAmountread-only

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

languagestring<ISO 639-1>

Language code in the ISO 639-1 format (e.g. 'en'). Supported values: `az`, `de`, `en`, `en-GB`, `es`, `et`, `fr`, `it`, `lt`, `lv`, `pt`, `pt-BR`, `ru`, `tr`, `uk`.

notesstring
debtMoneyAmount

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

subtotal_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

total_tax_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

total_discount_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

total_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

request_client_detailsarray<enum>

ClientDetails fields to request from the client before the payment. If a value is passed for a field in ClientDetails, it will be automatically removed from this list.

timezonestring<TZ database name>

Timezone to localize invoice-specific timestamps in, e.g. to display a concrete date for a `due` timestamp on the invoice.

due_strictboolean

Whether to permit payments when Purchase's `due` has passed. By default those are permitted (and status will be set to `overdue` once `due` moment is passed). If this is set to `true`, it won't be possible to pay for an overdue invoice, and when `due` is passed the Purchase's status will be set to `expired`.

email_messagestringread-only

An optional message to display to your customer in invoice email, e.g. "Your invoice for June".

metadataobject

Custom information with maximum length of 10000 characters

single_attemptboolean

When set to true, prevents retry attempts if the payment fails. The purchase will be immediately marked as cancelled upon failure, and the payer will not see a retry button on the failure page. If not provided, inherits the value from the Company's `single_attempt` setting.

company_idstring<uuid>read-only
number_of_billing_cyclesinteger

Limits number of billing cycles for each client if set to a non-zero value

is_testbooleanread-only

Indicates this is a test object, created using test API keys or using Billing section of UI while in test mode.

user_idstring<uuid>read-onlynullable

ID of user who has created this object in the Billing UI, if applicable.

brand_idstring<uuid>

ID of the brand to create this BillingTemplate for. You can copy it down in the API section, see the "specify the ID of the Brand" link in answer to "How to setup payments on website or in mobile app?".

titlestring
is_subscriptionbooleanrequired

Defines whether this BillingTemplate issues invoices in a recurring manner - it's a subscription - or it sends invoices only once. You can't change this parameter when you edit the BillingTemplate. If this field is `true`, you will need to specify `subscription_*` fields and `invoice_*` fields are read-only, and vice-versa.

invoice_issuedTimestampnullable

Sets `issued` on the Purchase objects generated. Generated from current day in `purchase.timezone` if not provided. Read-only if `is_subscription == true`.

invoice_dueUnixTimestampnullable

Sets `due` on the Purchase objects generated. Required if `is_subscription == false`, read-only otherwise.

invoice_skip_captureboolean

Sets `skip_capture` on the Purchase objects generated. `false` by default. Read-only if `is_subscription == true`.

invoice_send_receiptboolean

Sets `send_receipt` on the Purchase objects generated. `true` by default (unlike in Purchases API, where by default receipts are not sent). Read-only if `is_subscription == true`.

subscription_periodinteger

Defines how often are the subscription Purchases generated. Used together with `subscription_period_units`: to issue Purchases once a month, use `"...period": 1` and `"...period_units" == "months"`. Variable number of days in a month is respected; e.g. if subscription has a period of 1 month, a client had its billing cycle activated on January 30 and there…

subscription_period_unitsPeriodUnits

See `subscription_period`.

subscription_due_periodinteger

Used to generate `due` on the Purchase objects generated. Used together with `subscription_due_period_units`: to set the final `Purchase.due` to a week after it's generated/invoice is sent, use `"...period": 1` and `"...period_units" == "weeks". Required if `is_subscription == true`, read-only otherwise.

subscription_due_period_unitsPeriodUnits

See `subscription_due_period`.

subscription_charge_period_endboolean

If this is `true`, clients are charged at the end of billing periods, and vice-versa. E.g. if you add a subscriber client to a BillingTemplate, with this value being set to `false`, he will receive first invoice today, otherwise - after a single billing period (defined by `subscription_period`/`subscription_period_units`) passes. Required when creating a B…

subscription_trial_periodsinteger

How many trial periods to give the client prior to starting his billing cycle. If billing period is 1 month and you set this value to 2, subscription will automatically adjust to giving your client 2 months without payments and then charging him for the 3rd month (when exactly depends on `subscription_charge_period_end`: 3 months after the subscriber was lau…

subscription_activeboolean

Whether this subscription is paused. Has the same effect as setting `"status": "subscription_paused"` for every BillingTemplateClient launched for this subscription, see the description of `status` on BillingTemplateClient for more details. Ignored (read-only) if `is_subscription == false`.

subscription_has_active_clientsbooleanread-only

If this is `true`, there were launched clients (`POST /billing_templates/{id}/add_subscriber/` - or subscribers that were added via the gateway system UI) for this subscription. While this is `false` (it will be as long as you're only just created the template and haven't launched any subscribers), you can edit all of `subscription_*` fields. If this is `…

force_recurringboolean

If the used payment method supports recurring payment functionality, forces the customer's payment credentials to be saved for possible later recurring payments, without giving the customer a choice in the matter.

upsell_campaignsarray<string<uuid>>

Array of IDs of related Upsell campaigns.

referral_campaign_idstring<uuid>nullable

ID of Referral campaign.

Response · 200

OK

curl -X POST "https://gate.safari.tech/api/v1/billing/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "clients": [
      {}
    ]
  }'
Response
[
  "720e2c96-ef94-4baa-90b6-d61ef6fd675a"
]
get/billing_templates/

List all billing templates.

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/billing_templates/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "results": [
    {}
  ],
  "next": "string",
  "previous": "string"
}
post/billing_templates/

Create a template to issue repeated invoices from in the future, with or without a subscription.

BillingTemplate generates Purchase objects, either to issue one-time invoices or in a subscription. It does so by copying over its' `PurchaseDetails`, one of its `BillingTemplateClient`-s and generating other fields from BillingTemplate's fields as necessary into a new `Purchase` object. If `is_subscription` is `true`, it is considered to be a subscription's BillingTemplate. You will need to specify `subscription_*` fields like `subscription_period` when creating it and add BillingTemplateClient objects to its billing cycle (`POST /billing_templates/{id}/add_subscriber/`). After that the cli…

Request body

purchasePurchaseDetailsrequired

Core information about the Purchase, including the products, total, currency and invoice fields. If you're using invoicing via `/billing/` or `/billing_templates/`, this object will be copied 1:1 from BillingTemplate you specify to the resulting Purchases (also to subscription Purchases).

Show child attributes
currencyCurrency

Currency code in the ISO 4217 standard (e.g. 'EUR'). Default currency is `EUR`.

productsarray<Product>required

Line items of the invoice. In case of a transaction with no invoice sent, specify a single Product forming the cost of transaction.

Show child attributes
namestringrequired

Product name

quantitystring<float>

Quantity of these products in invoice

priceMoneyAmountrequired

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY. You can use this field or `total_override` with a value of 0 to activate preauthorization scenario. See the description of the `Purchase.skip_capture` field.

discountMoneyAmount

Total discount per this product in invoice

tax_percentstring<float>

Percent of tax added to the price of this product

categorystring

Product category

total_price_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

totalMoneyAmountread-only

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

languagestring<ISO 639-1>

Language code in the ISO 639-1 format (e.g. 'en'). Supported values: `az`, `de`, `en`, `en-GB`, `es`, `et`, `fr`, `it`, `lt`, `lv`, `pt`, `pt-BR`, `ru`, `tr`, `uk`.

notesstring
debtMoneyAmount

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

subtotal_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

total_tax_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

total_discount_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

total_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

request_client_detailsarray<enum>

ClientDetails fields to request from the client before the payment. If a value is passed for a field in ClientDetails, it will be automatically removed from this list.

timezonestring<TZ database name>

Timezone to localize invoice-specific timestamps in, e.g. to display a concrete date for a `due` timestamp on the invoice.

due_strictboolean

Whether to permit payments when Purchase's `due` has passed. By default those are permitted (and status will be set to `overdue` once `due` moment is passed). If this is set to `true`, it won't be possible to pay for an overdue invoice, and when `due` is passed the Purchase's status will be set to `expired`.

email_messagestringread-only

An optional message to display to your customer in invoice email, e.g. "Your invoice for June".

metadataobject

Custom information with maximum length of 10000 characters

single_attemptboolean

When set to true, prevents retry attempts if the payment fails. The purchase will be immediately marked as cancelled upon failure, and the payer will not see a retry button on the failure page. If not provided, inherits the value from the Company's `single_attempt` setting.

company_idstring<uuid>read-only
number_of_billing_cyclesinteger

Limits number of billing cycles for each client if set to a non-zero value

is_testbooleanread-only

Indicates this is a test object, created using test API keys or using Billing section of UI while in test mode.

user_idstring<uuid>read-onlynullable

ID of user who has created this object in the Billing UI, if applicable.

brand_idstring<uuid>

ID of the brand to create this BillingTemplate for. You can copy it down in the API section, see the "specify the ID of the Brand" link in answer to "How to setup payments on website or in mobile app?".

titlestring
is_subscriptionbooleanrequired

Defines whether this BillingTemplate issues invoices in a recurring manner - it's a subscription - or it sends invoices only once. You can't change this parameter when you edit the BillingTemplate. If this field is `true`, you will need to specify `subscription_*` fields and `invoice_*` fields are read-only, and vice-versa.

invoice_issuedTimestampnullable

Sets `issued` on the Purchase objects generated. Generated from current day in `purchase.timezone` if not provided. Read-only if `is_subscription == true`.

invoice_dueUnixTimestampnullable

Sets `due` on the Purchase objects generated. Required if `is_subscription == false`, read-only otherwise.

invoice_skip_captureboolean

Sets `skip_capture` on the Purchase objects generated. `false` by default. Read-only if `is_subscription == true`.

invoice_send_receiptboolean

Sets `send_receipt` on the Purchase objects generated. `true` by default (unlike in Purchases API, where by default receipts are not sent). Read-only if `is_subscription == true`.

subscription_periodinteger

Defines how often are the subscription Purchases generated. Used together with `subscription_period_units`: to issue Purchases once a month, use `"...period": 1` and `"...period_units" == "months"`. Variable number of days in a month is respected; e.g. if subscription has a period of 1 month, a client had its billing cycle activated on January 30 and there…

subscription_period_unitsPeriodUnits

See `subscription_period`.

subscription_due_periodinteger

Used to generate `due` on the Purchase objects generated. Used together with `subscription_due_period_units`: to set the final `Purchase.due` to a week after it's generated/invoice is sent, use `"...period": 1` and `"...period_units" == "weeks". Required if `is_subscription == true`, read-only otherwise.

subscription_due_period_unitsPeriodUnits

See `subscription_due_period`.

subscription_charge_period_endboolean

If this is `true`, clients are charged at the end of billing periods, and vice-versa. E.g. if you add a subscriber client to a BillingTemplate, with this value being set to `false`, he will receive first invoice today, otherwise - after a single billing period (defined by `subscription_period`/`subscription_period_units`) passes. Required when creating a B…

subscription_trial_periodsinteger

How many trial periods to give the client prior to starting his billing cycle. If billing period is 1 month and you set this value to 2, subscription will automatically adjust to giving your client 2 months without payments and then charging him for the 3rd month (when exactly depends on `subscription_charge_period_end`: 3 months after the subscriber was lau…

subscription_activeboolean

Whether this subscription is paused. Has the same effect as setting `"status": "subscription_paused"` for every BillingTemplateClient launched for this subscription, see the description of `status` on BillingTemplateClient for more details. Ignored (read-only) if `is_subscription == false`.

subscription_has_active_clientsbooleanread-only

If this is `true`, there were launched clients (`POST /billing_templates/{id}/add_subscriber/` - or subscribers that were added via the gateway system UI) for this subscription. While this is `false` (it will be as long as you're only just created the template and haven't launched any subscribers), you can edit all of `subscription_*` fields. If this is `…

force_recurringboolean

If the used payment method supports recurring payment functionality, forces the customer's payment credentials to be saved for possible later recurring payments, without giving the customer a choice in the matter.

upsell_campaignsarray<string<uuid>>

Array of IDs of related Upsell campaigns.

referral_campaign_idstring<uuid>nullable

ID of Referral campaign.

typestringread-only

Object type identifier

idstring<uuid>read-only
created_onUnixTimestampread-only

Object creation time

updated_onUnixTimestampread-only

Object last modification time

Response · 201

OK

curl -X POST "https://gate.safari.tech/api/v1/billing_templates/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
Response
{}
get/billing_templates/{id}/

Retrieve a billing template by ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/billing_templates/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{}
put/billing_templates/{id}/

Update a billing template by ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Request body

purchasePurchaseDetailsrequired

Core information about the Purchase, including the products, total, currency and invoice fields. If you're using invoicing via `/billing/` or `/billing_templates/`, this object will be copied 1:1 from BillingTemplate you specify to the resulting Purchases (also to subscription Purchases).

Show child attributes
currencyCurrency

Currency code in the ISO 4217 standard (e.g. 'EUR'). Default currency is `EUR`.

productsarray<Product>required

Line items of the invoice. In case of a transaction with no invoice sent, specify a single Product forming the cost of transaction.

Show child attributes
namestringrequired

Product name

quantitystring<float>

Quantity of these products in invoice

priceMoneyAmountrequired

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY. You can use this field or `total_override` with a value of 0 to activate preauthorization scenario. See the description of the `Purchase.skip_capture` field.

discountMoneyAmount

Total discount per this product in invoice

tax_percentstring<float>

Percent of tax added to the price of this product

categorystring

Product category

total_price_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

totalMoneyAmountread-only

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

languagestring<ISO 639-1>

Language code in the ISO 639-1 format (e.g. 'en'). Supported values: `az`, `de`, `en`, `en-GB`, `es`, `et`, `fr`, `it`, `lt`, `lv`, `pt`, `pt-BR`, `ru`, `tr`, `uk`.

notesstring
debtMoneyAmount

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

subtotal_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

total_tax_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

total_discount_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

total_overrideMoneyAmountnullable

Amount of money as the smallest indivisible units of the currency. Examples: 1 cent for EUR and 1 Yen for JPY.

request_client_detailsarray<enum>

ClientDetails fields to request from the client before the payment. If a value is passed for a field in ClientDetails, it will be automatically removed from this list.

timezonestring<TZ database name>

Timezone to localize invoice-specific timestamps in, e.g. to display a concrete date for a `due` timestamp on the invoice.

due_strictboolean

Whether to permit payments when Purchase's `due` has passed. By default those are permitted (and status will be set to `overdue` once `due` moment is passed). If this is set to `true`, it won't be possible to pay for an overdue invoice, and when `due` is passed the Purchase's status will be set to `expired`.

email_messagestringread-only

An optional message to display to your customer in invoice email, e.g. "Your invoice for June".

metadataobject

Custom information with maximum length of 10000 characters

single_attemptboolean

When set to true, prevents retry attempts if the payment fails. The purchase will be immediately marked as cancelled upon failure, and the payer will not see a retry button on the failure page. If not provided, inherits the value from the Company's `single_attempt` setting.

company_idstring<uuid>read-only
number_of_billing_cyclesinteger

Limits number of billing cycles for each client if set to a non-zero value

is_testbooleanread-only

Indicates this is a test object, created using test API keys or using Billing section of UI while in test mode.

user_idstring<uuid>read-onlynullable

ID of user who has created this object in the Billing UI, if applicable.

brand_idstring<uuid>

ID of the brand to create this BillingTemplate for. You can copy it down in the API section, see the "specify the ID of the Brand" link in answer to "How to setup payments on website or in mobile app?".

titlestring
is_subscriptionbooleanrequired

Defines whether this BillingTemplate issues invoices in a recurring manner - it's a subscription - or it sends invoices only once. You can't change this parameter when you edit the BillingTemplate. If this field is `true`, you will need to specify `subscription_*` fields and `invoice_*` fields are read-only, and vice-versa.

invoice_issuedTimestampnullable

Sets `issued` on the Purchase objects generated. Generated from current day in `purchase.timezone` if not provided. Read-only if `is_subscription == true`.

invoice_dueUnixTimestampnullable

Sets `due` on the Purchase objects generated. Required if `is_subscription == false`, read-only otherwise.

invoice_skip_captureboolean

Sets `skip_capture` on the Purchase objects generated. `false` by default. Read-only if `is_subscription == true`.

invoice_send_receiptboolean

Sets `send_receipt` on the Purchase objects generated. `true` by default (unlike in Purchases API, where by default receipts are not sent). Read-only if `is_subscription == true`.

subscription_periodinteger

Defines how often are the subscription Purchases generated. Used together with `subscription_period_units`: to issue Purchases once a month, use `"...period": 1` and `"...period_units" == "months"`. Variable number of days in a month is respected; e.g. if subscription has a period of 1 month, a client had its billing cycle activated on January 30 and there…

subscription_period_unitsPeriodUnits

See `subscription_period`.

subscription_due_periodinteger

Used to generate `due` on the Purchase objects generated. Used together with `subscription_due_period_units`: to set the final `Purchase.due` to a week after it's generated/invoice is sent, use `"...period": 1` and `"...period_units" == "weeks". Required if `is_subscription == true`, read-only otherwise.

subscription_due_period_unitsPeriodUnits

See `subscription_due_period`.

subscription_charge_period_endboolean

If this is `true`, clients are charged at the end of billing periods, and vice-versa. E.g. if you add a subscriber client to a BillingTemplate, with this value being set to `false`, he will receive first invoice today, otherwise - after a single billing period (defined by `subscription_period`/`subscription_period_units`) passes. Required when creating a B…

subscription_trial_periodsinteger

How many trial periods to give the client prior to starting his billing cycle. If billing period is 1 month and you set this value to 2, subscription will automatically adjust to giving your client 2 months without payments and then charging him for the 3rd month (when exactly depends on `subscription_charge_period_end`: 3 months after the subscriber was lau…

subscription_activeboolean

Whether this subscription is paused. Has the same effect as setting `"status": "subscription_paused"` for every BillingTemplateClient launched for this subscription, see the description of `status` on BillingTemplateClient for more details. Ignored (read-only) if `is_subscription == false`.

subscription_has_active_clientsbooleanread-only

If this is `true`, there were launched clients (`POST /billing_templates/{id}/add_subscriber/` - or subscribers that were added via the gateway system UI) for this subscription. While this is `false` (it will be as long as you're only just created the template and haven't launched any subscribers), you can edit all of `subscription_*` fields. If this is `…

force_recurringboolean

If the used payment method supports recurring payment functionality, forces the customer's payment credentials to be saved for possible later recurring payments, without giving the customer a choice in the matter.

upsell_campaignsarray<string<uuid>>

Array of IDs of related Upsell campaigns.

referral_campaign_idstring<uuid>nullable

ID of Referral campaign.

typestringread-only

Object type identifier

idstring<uuid>read-only
created_onUnixTimestampread-only

Object creation time

updated_onUnixTimestampread-only

Object last modification time

Response · 200

OK

curl -X PUT "https://gate.safari.tech/api/v1/billing_templates/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
Response
{}
delete/billing_templates/{id}/

Delete a billing template by ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 204

OK

curl -X DELETE "https://gate.safari.tech/api/v1/billing_templates/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY"
post/billing_templates/{id}/send_invoice/

Send an invoice, generating a purchase from billing template data.

Use this request with a BillingTemplate having `is_subscription == false`. Specify the BillingTemplateClient data (only `client_id` field is needed) in the request body. The request will issue a Purchase by combining data of `BillingTemplate.purchase` and `BillingTemplateClient.client` and will send an invoice to your Client. Response will contain data of a created Purchase. The BillingTemplateClient will not be saved.

Path parameters

idstring<uuid>required

Object ID (UUID)

Request body

client_idstring<uuid>required

ID of the Client object to add to the BillingTemplate. Read-only after the BillingTemplateClient has been created. Note that the same Client can be added to a BillingTemplate several times.

number_of_billing_cycles_passedintegerread-only

Only used together with number_of_billing_cycles on BillingTemplate. Shows number of billing cycles passed when number of cycles is limited

invoice_referencestringnullable

When present overrides reference for invoices generated for this client

statusenum

For subscriptions, you can edit (`PATCH /billing_templates/{id}/clients/{id}/`) this status between `active` and `subscription_paused` values to pause the client's subscription. Paused subscriptions run as normal, except for purchases not being created and invoices sent for them. It means that if you pause a BillingTemplateClient's monthly subscription cycle…

pendinginactiveactivesubscription_paused
subscription_billing_scheduled_onTimestampread-onlynullable

If not null, reports the date when the next billing is scheduled for this client.

payment_method_whitelistarray<string>

An optional whitelist of payment methods availble for purchases generated for this BillingTemplateClient. Copied 1:1 to `Purchase.payment_method_whitelist` field on created Purchases (see its description).

send_invoice_on_charge_failureboolean

Sends invoice when subscription charge fails if this is `true`

send_invoice_on_add_subscriberboolean

Sends invoice when `POST /billing_templates/{id}/add_subscriber/` is called if this is `true`

send_receiptboolean

Sends receipt when subscription charge succeeds if this is `true`

typestringread-only

Object type identifier

idstring<uuid>read-only
created_onUnixTimestampread-only

Object creation time

updated_onUnixTimestampread-only

Object last modification time

Response · 200

OK

curl -X POST "https://gate.safari.tech/api/v1/billing_templates/{id}/send_invoice/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "b79d3df6-2f69-4426-acee-eda049d83e18"
  }'
Response
{}
post/billing_templates/{id}/add_subscriber/

Add a billing template client and activate recurring billing (is_subscription: true).

Use this request with a BillingTemplate having `is_subscription == true`. Two scenarios are possible: • If `subscription_charge_period_end == true` and/or `subscription_trial_periods > 0` (first billing should happen after 1 or more billing periods, not today), the request will create a BillingTemplateClient and start trial/schedule billing for it (as required by subscription settings). Successful response will be of form `{billing_template_client: <BillingTemplateClient object created>, purchase: null}`: no Purchase is created, `BillingTemplateClient.status` is `active` immediately. • If…

Path parameters

idstring<uuid>required

Object ID (UUID)

Request body

client_idstring<uuid>required

ID of the Client object to add to the BillingTemplate. Read-only after the BillingTemplateClient has been created. Note that the same Client can be added to a BillingTemplate several times.

number_of_billing_cycles_passedintegerread-only

Only used together with number_of_billing_cycles on BillingTemplate. Shows number of billing cycles passed when number of cycles is limited

invoice_referencestringnullable

When present overrides reference for invoices generated for this client

statusenum

For subscriptions, you can edit (`PATCH /billing_templates/{id}/clients/{id}/`) this status between `active` and `subscription_paused` values to pause the client's subscription. Paused subscriptions run as normal, except for purchases not being created and invoices sent for them. It means that if you pause a BillingTemplateClient's monthly subscription cycle…

pendinginactiveactivesubscription_paused
subscription_billing_scheduled_onTimestampread-onlynullable

If not null, reports the date when the next billing is scheduled for this client.

payment_method_whitelistarray<string>

An optional whitelist of payment methods availble for purchases generated for this BillingTemplateClient. Copied 1:1 to `Purchase.payment_method_whitelist` field on created Purchases (see its description).

send_invoice_on_charge_failureboolean

Sends invoice when subscription charge fails if this is `true`

send_invoice_on_add_subscriberboolean

Sends invoice when `POST /billing_templates/{id}/add_subscriber/` is called if this is `true`

send_receiptboolean

Sends receipt when subscription charge succeeds if this is `true`

typestringread-only

Object type identifier

idstring<uuid>read-only
created_onUnixTimestampread-only

Object creation time

updated_onUnixTimestampread-only

Object last modification time

Response · 200

OK

curl -X POST "https://gate.safari.tech/api/v1/billing_templates/{id}/add_subscriber/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "b79d3df6-2f69-4426-acee-eda049d83e18"
  }'
Response
{
  "billing_template_client": {},
  "purchase": {}
}
get/billing_templates/{id}/clients/

List all billing template clients for this billing template.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/billing_templates/{id}/clients/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "results": [
    {}
  ],
  "next": "string",
  "previous": "string"
}
get/billing_templates/{id}/clients/{id}/

Retrieve a billing template client by client's ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/billing_templates/{id}/clients/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{}
patch/billing_templates/{id}/clients/{id}/

Partially update a billing template client by client's ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Request body

client_idstring<uuid>required

ID of the Client object to add to the BillingTemplate. Read-only after the BillingTemplateClient has been created. Note that the same Client can be added to a BillingTemplate several times.

number_of_billing_cycles_passedintegerread-only

Only used together with number_of_billing_cycles on BillingTemplate. Shows number of billing cycles passed when number of cycles is limited

invoice_referencestringnullable

When present overrides reference for invoices generated for this client

statusenum

For subscriptions, you can edit (`PATCH /billing_templates/{id}/clients/{id}/`) this status between `active` and `subscription_paused` values to pause the client's subscription. Paused subscriptions run as normal, except for purchases not being created and invoices sent for them. It means that if you pause a BillingTemplateClient's monthly subscription cycle…

pendinginactiveactivesubscription_paused
subscription_billing_scheduled_onTimestampread-onlynullable

If not null, reports the date when the next billing is scheduled for this client.

payment_method_whitelistarray<string>

An optional whitelist of payment methods availble for purchases generated for this BillingTemplateClient. Copied 1:1 to `Purchase.payment_method_whitelist` field on created Purchases (see its description).

send_invoice_on_charge_failureboolean

Sends invoice when subscription charge fails if this is `true`

send_invoice_on_add_subscriberboolean

Sends invoice when `POST /billing_templates/{id}/add_subscriber/` is called if this is `true`

send_receiptboolean

Sends receipt when subscription charge succeeds if this is `true`

typestringread-only

Object type identifier

idstring<uuid>read-only
created_onUnixTimestampread-only

Object creation time

updated_onUnixTimestampread-only

Object last modification time

Response · 200

OK

curl -X PATCH "https://gate.safari.tech/api/v1/billing_templates/{id}/clients/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "active"
  }'
Response
{}
Resource

Clients

9 endpoints

get/clients/

List all clients.

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/clients/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "results": [
    {
      "bank_account": "string",
      "bank_code": "string"
    }
  ],
  "next": "string",
  "previous": "string"
}
post/clients/

Create a new client.

Client is a record of a single customer of your business. Create one for each of your clients; you will be able to issue invoices/subscriptions for them later easily using `/billing_templates/` API. Each BillingTemplateClient (there can be many attached to a single BillingTemplate) will bind a single Client to a BillingTemplate.

Request body

typestringread-only

Object type identifier

idstring<uuid>read-only
created_onUnixTimestampread-only

Object creation time

updated_onUnixTimestampread-only

Object last modification time

emailEmailrequired

Email address

phonePhone

Phone number in the `<country_code> <number>` format

full_namestring

Name and surname of client

personal_codestring

Personal identification code of client

street_addressStreetAddress

Street house number and flat address where applicable

countryCountry

Country code in the ISO 3166-1 alpha-2 format (e.g. 'GB')

cityCity

City name

zip_codeZIPCode

ZIP or postal code

stateState

State code

shipping_street_addressStreetAddress

Street house number and flat address where applicable

shipping_countryCountry

Country code in the ISO 3166-1 alpha-2 format (e.g. 'GB')

shipping_cityCity

City name

shipping_zip_codeZIPCode

ZIP or postal code

shipping_stateState

State code

ccarray<Email>

Email addresses to receive a carbon copy of all notification emails

bccarray<Email>

Email addresses to receive a blind carbon copy of all notification emails

legal_namestring

Legal name of company

brand_namestring

Company brand name

registration_numberstring

Registration number of company

tax_numberstring

Tax payer registration number

delivery_methodsarray<object>

List of delivery methods for invoices

Show child attributes
methodenumrequired

The method of invoice delivery

emailtext_message
optionsobjectrequired

Additional options for the delivery method

Show child attributes
custom_messagestring

Custom message for text message delivery

Response · 201

OK

curl -X POST "https://gate.safari.tech/api/v1/clients/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "bank_account": "string",
    "bank_code": "string"
  }'
Response
{
  "bank_account": "string",
  "bank_code": "string"
}
get/clients/{id}/

Retrieve an object by ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/clients/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "bank_account": "string",
  "bank_code": "string"
}
put/clients/{id}/

Update a client by ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Request body

typestringread-only

Object type identifier

idstring<uuid>read-only
created_onUnixTimestampread-only

Object creation time

updated_onUnixTimestampread-only

Object last modification time

emailEmailrequired

Email address

phonePhone

Phone number in the `<country_code> <number>` format

full_namestring

Name and surname of client

personal_codestring

Personal identification code of client

street_addressStreetAddress

Street house number and flat address where applicable

countryCountry

Country code in the ISO 3166-1 alpha-2 format (e.g. 'GB')

cityCity

City name

zip_codeZIPCode

ZIP or postal code

stateState

State code

shipping_street_addressStreetAddress

Street house number and flat address where applicable

shipping_countryCountry

Country code in the ISO 3166-1 alpha-2 format (e.g. 'GB')

shipping_cityCity

City name

shipping_zip_codeZIPCode

ZIP or postal code

shipping_stateState

State code

ccarray<Email>

Email addresses to receive a carbon copy of all notification emails

bccarray<Email>

Email addresses to receive a blind carbon copy of all notification emails

legal_namestring

Legal name of company

brand_namestring

Company brand name

registration_numberstring

Registration number of company

tax_numberstring

Tax payer registration number

delivery_methodsarray<object>

List of delivery methods for invoices

Show child attributes
methodenumrequired

The method of invoice delivery

emailtext_message
optionsobjectrequired

Additional options for the delivery method

Show child attributes
custom_messagestring

Custom message for text message delivery

Response · 200

OK

curl -X PUT "https://gate.safari.tech/api/v1/clients/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "bank_account": "string",
    "bank_code": "string"
  }'
Response
{
  "bank_account": "string",
  "bank_code": "string"
}
patch/clients/{id}/

Partially update a client by ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Request body

typestringread-only

Object type identifier

idstring<uuid>read-only
created_onUnixTimestampread-only

Object creation time

updated_onUnixTimestampread-only

Object last modification time

emailEmailrequired

Email address

phonePhone

Phone number in the `<country_code> <number>` format

full_namestring

Name and surname of client

personal_codestring

Personal identification code of client

street_addressStreetAddress

Street house number and flat address where applicable

countryCountry

Country code in the ISO 3166-1 alpha-2 format (e.g. 'GB')

cityCity

City name

zip_codeZIPCode

ZIP or postal code

stateState

State code

shipping_street_addressStreetAddress

Street house number and flat address where applicable

shipping_countryCountry

Country code in the ISO 3166-1 alpha-2 format (e.g. 'GB')

shipping_cityCity

City name

shipping_zip_codeZIPCode

ZIP or postal code

shipping_stateState

State code

ccarray<Email>

Email addresses to receive a carbon copy of all notification emails

bccarray<Email>

Email addresses to receive a blind carbon copy of all notification emails

legal_namestring

Legal name of company

brand_namestring

Company brand name

registration_numberstring

Registration number of company

tax_numberstring

Tax payer registration number

delivery_methodsarray<object>

List of delivery methods for invoices

Show child attributes
methodenumrequired

The method of invoice delivery

emailtext_message
optionsobjectrequired

Additional options for the delivery method

Show child attributes
custom_messagestring

Custom message for text message delivery

Response · 200

OK

curl -X PATCH "https://gate.safari.tech/api/v1/clients/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "bank_account": "string",
    "bank_code": "string"
  }'
Response
{
  "bank_account": "string",
  "bank_code": "string"
}
delete/clients/{id}/

Delete a client by ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 204

OK

curl -X DELETE "https://gate.safari.tech/api/v1/clients/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY"
get/clients/{id}/recurring_tokens/

List recurring tokens saved for a client.

All of these tokens will be available in a checkout (see `Purchase.checkout_url`) if you create a Purchase with this client's ID in `client_id` field. You can use one in `POST /purchases/{id}/charge/`, too. Note that you can use one client's `recurring_token` to pay a Purchase created for a different `client_id` or created with no `client_id` at all; it's not recommended to do this.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/clients/{id}/recurring_tokens/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "results": [
    {}
  ],
  "next": "string",
  "previous": "string"
}
get/clients/{id}/recurring_tokens/{id}/

Retrieve an object by ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/clients/{id}/recurring_tokens/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{}
delete/clients/{id}/recurring_tokens/{id}/

Delete a client recurring token by ID.

If you create the Purchase with the respective Client's ID (in `.client_id`), he won't see this token as available on checkout page anymore. You also won't be able to use the ID of this object as a `recurring_token` in `POST /purchases/{id}/charge/`. The respective Purchase will have `is_recurring_token` set to `false` (as if `POST /purchases/{recurring_token}/delete_recurring_token/` was issued).

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 204

OK

curl -X DELETE "https://gate.safari.tech/api/v1/clients/{id}/recurring_tokens/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Resource

Webhooks

7 endpoints

get/webhooks/

List all webhooks.

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/webhooks/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "results": [
    {
      "title": "string",
      "all_events": false,
      "public_key": "-----BEGIN PUBLIC KEY-----\nMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA6gLlBKxCB5dxPJbinCzl\nhOfKSgQtOWQQBxmnWIkEVUbqhpnqr3xNYiAvDyMUxYUwuzN44eHO+mR9MZWcSx3c\nbXmKa3gsOzR6GdcOxMGaVxvfje+fujCAlCtO1BP+A9/FS3KcPgCYG1wtAPwA5IAf\nHylL3TsUVIJQFBgiBr6N4Bgapr9eloaFfeYIBRsXmxPKAMJivqxYpLh0V3N4ZFd5\nTGqSEAa4b1ULDr6p0sB2L3QikTdsF0zp03zNceKA6fXDOzD0xWtg9buXvyKwePK4\nM2kcnWBNfsWghrdg0fG3O9bmkaS1oEXydrmJfuiI8h6a64J/1nzooi2yLC9D6Ta0\nS63bbuAHymnQtiNuV7Ixp6IoTGFaS88aTiHaP8rdyWV8JTDFx0qeDzyaGWiYGwEF\nmj/buHCEcRhoajbGkPhYA4YEdn4jy1wZhEr2OMdBPM7mPPI0Hy3hcNJVMVVlrpHe\nIltQATpjlNaJMlRPjbcaiW7dsO3BuF9ZOMGksSOnyYm/AgMBAAE=\n-----END PUBLIC KEY-----",
      "events": [
        "purchase.created"
      ],
      "callback": "https://example.com"
    }
  ],
  "next": "string",
  "previous": "string"
}
post/webhooks/

Create a new webhook.

Request body

typestringread-only

Object type identifier

idstring<uuid>read-only
created_onUnixTimestampread-only

Object creation time

updated_onUnixTimestampread-only

Object last modification time

titlestringrequired

Arbitrary title of webhook

all_eventsboolean

Specifies this webhook should trigger on all event types. Either this or `events` is required.

public_keyPublicKeyread-only

PEM-encoded RSA public key for authenticating webhook or callback payloads

eventsarray<Event>required

List of events to trigger webhook callbacks for. Either this or `all_events` is required.

callbackURLrequired

Response · 201

OK

curl -X POST "https://gate.safari.tech/api/v1/webhooks/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "string",
    "all_events": false,
    "public_key": "-----BEGIN PUBLIC KEY-----\nMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA6gLlBKxCB5dxPJbinCzl\nhOfKSgQtOWQQBxmnWIkEVUbqhpnqr3xNYiAvDyMUxYUwuzN44eHO+mR9MZWcSx3c\nbXmKa3gsOzR6GdcOxMGaVxvfje+fujCAlCtO1BP+A9/FS3KcPgCYG1wtAPwA5IAf\nHylL3TsUVIJQFBgiBr6N4Bgapr9eloaFfeYIBRsXmxPKAMJivqxYpLh0V3N4ZFd5\nTGqSEAa4b1ULDr6p0sB2L3QikTdsF0zp03zNceKA6fXDOzD0xWtg9buXvyKwePK4\nM2kcnWBNfsWghrdg0fG3O9bmkaS1oEXydrmJfuiI8h6a64J/1nzooi2yLC9D6Ta0\nS63bbuAHymnQtiNuV7Ixp6IoTGFaS88aTiHaP8rdyWV8JTDFx0qeDzyaGWiYGwEF\nmj/buHCEcRhoajbGkPhYA4YEdn4jy1wZhEr2OMdBPM7mPPI0Hy3hcNJVMVVlrpHe\nIltQATpjlNaJMlRPjbcaiW7dsO3BuF9ZOMGksSOnyYm/AgMBAAE=\n-----END PUBLIC KEY-----",
    "events": [
      "purchase.created"
    ],
    "callback": "https://example.com"
  }'
Response
{
  "title": "string",
  "all_events": false,
  "public_key": "-----BEGIN PUBLIC KEY-----\nMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA6gLlBKxCB5dxPJbinCzl\nhOfKSgQtOWQQBxmnWIkEVUbqhpnqr3xNYiAvDyMUxYUwuzN44eHO+mR9MZWcSx3c\nbXmKa3gsOzR6GdcOxMGaVxvfje+fujCAlCtO1BP+A9/FS3KcPgCYG1wtAPwA5IAf\nHylL3TsUVIJQFBgiBr6N4Bgapr9eloaFfeYIBRsXmxPKAMJivqxYpLh0V3N4ZFd5\nTGqSEAa4b1ULDr6p0sB2L3QikTdsF0zp03zNceKA6fXDOzD0xWtg9buXvyKwePK4\nM2kcnWBNfsWghrdg0fG3O9bmkaS1oEXydrmJfuiI8h6a64J/1nzooi2yLC9D6Ta0\nS63bbuAHymnQtiNuV7Ixp6IoTGFaS88aTiHaP8rdyWV8JTDFx0qeDzyaGWiYGwEF\nmj/buHCEcRhoajbGkPhYA4YEdn4jy1wZhEr2OMdBPM7mPPI0Hy3hcNJVMVVlrpHe\nIltQATpjlNaJMlRPjbcaiW7dsO3BuF9ZOMGksSOnyYm/AgMBAAE=\n-----END PUBLIC KEY-----",
  "events": [
    "purchase.created"
  ],
  "callback": "https://example.com"
}
get/webhooks/{id}/

Retrieve an object by ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/webhooks/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "title": "string",
  "all_events": false,
  "public_key": "-----BEGIN PUBLIC KEY-----\nMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA6gLlBKxCB5dxPJbinCzl\nhOfKSgQtOWQQBxmnWIkEVUbqhpnqr3xNYiAvDyMUxYUwuzN44eHO+mR9MZWcSx3c\nbXmKa3gsOzR6GdcOxMGaVxvfje+fujCAlCtO1BP+A9/FS3KcPgCYG1wtAPwA5IAf\nHylL3TsUVIJQFBgiBr6N4Bgapr9eloaFfeYIBRsXmxPKAMJivqxYpLh0V3N4ZFd5\nTGqSEAa4b1ULDr6p0sB2L3QikTdsF0zp03zNceKA6fXDOzD0xWtg9buXvyKwePK4\nM2kcnWBNfsWghrdg0fG3O9bmkaS1oEXydrmJfuiI8h6a64J/1nzooi2yLC9D6Ta0\nS63bbuAHymnQtiNuV7Ixp6IoTGFaS88aTiHaP8rdyWV8JTDFx0qeDzyaGWiYGwEF\nmj/buHCEcRhoajbGkPhYA4YEdn4jy1wZhEr2OMdBPM7mPPI0Hy3hcNJVMVVlrpHe\nIltQATpjlNaJMlRPjbcaiW7dsO3BuF9ZOMGksSOnyYm/AgMBAAE=\n-----END PUBLIC KEY-----",
  "events": [
    "purchase.created"
  ],
  "callback": "https://example.com"
}
put/webhooks/{id}/

Update a webhook by ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Request body

typestringread-only

Object type identifier

idstring<uuid>read-only
created_onUnixTimestampread-only

Object creation time

updated_onUnixTimestampread-only

Object last modification time

titlestringrequired

Arbitrary title of webhook

all_eventsboolean

Specifies this webhook should trigger on all event types. Either this or `events` is required.

public_keyPublicKeyread-only

PEM-encoded RSA public key for authenticating webhook or callback payloads

eventsarray<Event>required

List of events to trigger webhook callbacks for. Either this or `all_events` is required.

callbackURLrequired

Response · 200

OK

curl -X PUT "https://gate.safari.tech/api/v1/webhooks/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "string",
    "all_events": false,
    "public_key": "-----BEGIN PUBLIC KEY-----\nMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA6gLlBKxCB5dxPJbinCzl\nhOfKSgQtOWQQBxmnWIkEVUbqhpnqr3xNYiAvDyMUxYUwuzN44eHO+mR9MZWcSx3c\nbXmKa3gsOzR6GdcOxMGaVxvfje+fujCAlCtO1BP+A9/FS3KcPgCYG1wtAPwA5IAf\nHylL3TsUVIJQFBgiBr6N4Bgapr9eloaFfeYIBRsXmxPKAMJivqxYpLh0V3N4ZFd5\nTGqSEAa4b1ULDr6p0sB2L3QikTdsF0zp03zNceKA6fXDOzD0xWtg9buXvyKwePK4\nM2kcnWBNfsWghrdg0fG3O9bmkaS1oEXydrmJfuiI8h6a64J/1nzooi2yLC9D6Ta0\nS63bbuAHymnQtiNuV7Ixp6IoTGFaS88aTiHaP8rdyWV8JTDFx0qeDzyaGWiYGwEF\nmj/buHCEcRhoajbGkPhYA4YEdn4jy1wZhEr2OMdBPM7mPPI0Hy3hcNJVMVVlrpHe\nIltQATpjlNaJMlRPjbcaiW7dsO3BuF9ZOMGksSOnyYm/AgMBAAE=\n-----END PUBLIC KEY-----",
    "events": [
      "purchase.created"
    ],
    "callback": "https://example.com"
  }'
Response
{
  "title": "string",
  "all_events": false,
  "public_key": "-----BEGIN PUBLIC KEY-----\nMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA6gLlBKxCB5dxPJbinCzl\nhOfKSgQtOWQQBxmnWIkEVUbqhpnqr3xNYiAvDyMUxYUwuzN44eHO+mR9MZWcSx3c\nbXmKa3gsOzR6GdcOxMGaVxvfje+fujCAlCtO1BP+A9/FS3KcPgCYG1wtAPwA5IAf\nHylL3TsUVIJQFBgiBr6N4Bgapr9eloaFfeYIBRsXmxPKAMJivqxYpLh0V3N4ZFd5\nTGqSEAa4b1ULDr6p0sB2L3QikTdsF0zp03zNceKA6fXDOzD0xWtg9buXvyKwePK4\nM2kcnWBNfsWghrdg0fG3O9bmkaS1oEXydrmJfuiI8h6a64J/1nzooi2yLC9D6Ta0\nS63bbuAHymnQtiNuV7Ixp6IoTGFaS88aTiHaP8rdyWV8JTDFx0qeDzyaGWiYGwEF\nmj/buHCEcRhoajbGkPhYA4YEdn4jy1wZhEr2OMdBPM7mPPI0Hy3hcNJVMVVlrpHe\nIltQATpjlNaJMlRPjbcaiW7dsO3BuF9ZOMGksSOnyYm/AgMBAAE=\n-----END PUBLIC KEY-----",
  "events": [
    "purchase.created"
  ],
  "callback": "https://example.com"
}
patch/webhooks/{id}/

Partially update a webhook by ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Request body

typestringread-only

Object type identifier

idstring<uuid>read-only
created_onUnixTimestampread-only

Object creation time

updated_onUnixTimestampread-only

Object last modification time

titlestringrequired

Arbitrary title of webhook

all_eventsboolean

Specifies this webhook should trigger on all event types. Either this or `events` is required.

public_keyPublicKeyread-only

PEM-encoded RSA public key for authenticating webhook or callback payloads

eventsarray<Event>required

List of events to trigger webhook callbacks for. Either this or `all_events` is required.

callbackURLrequired

Response · 200

OK

curl -X PATCH "https://gate.safari.tech/api/v1/webhooks/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "string",
    "all_events": false,
    "public_key": "-----BEGIN PUBLIC KEY-----\nMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA6gLlBKxCB5dxPJbinCzl\nhOfKSgQtOWQQBxmnWIkEVUbqhpnqr3xNYiAvDyMUxYUwuzN44eHO+mR9MZWcSx3c\nbXmKa3gsOzR6GdcOxMGaVxvfje+fujCAlCtO1BP+A9/FS3KcPgCYG1wtAPwA5IAf\nHylL3TsUVIJQFBgiBr6N4Bgapr9eloaFfeYIBRsXmxPKAMJivqxYpLh0V3N4ZFd5\nTGqSEAa4b1ULDr6p0sB2L3QikTdsF0zp03zNceKA6fXDOzD0xWtg9buXvyKwePK4\nM2kcnWBNfsWghrdg0fG3O9bmkaS1oEXydrmJfuiI8h6a64J/1nzooi2yLC9D6Ta0\nS63bbuAHymnQtiNuV7Ixp6IoTGFaS88aTiHaP8rdyWV8JTDFx0qeDzyaGWiYGwEF\nmj/buHCEcRhoajbGkPhYA4YEdn4jy1wZhEr2OMdBPM7mPPI0Hy3hcNJVMVVlrpHe\nIltQATpjlNaJMlRPjbcaiW7dsO3BuF9ZOMGksSOnyYm/AgMBAAE=\n-----END PUBLIC KEY-----",
    "events": [
      "purchase.created"
    ],
    "callback": "https://example.com"
  }'
Response
{
  "title": "string",
  "all_events": false,
  "public_key": "-----BEGIN PUBLIC KEY-----\nMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA6gLlBKxCB5dxPJbinCzl\nhOfKSgQtOWQQBxmnWIkEVUbqhpnqr3xNYiAvDyMUxYUwuzN44eHO+mR9MZWcSx3c\nbXmKa3gsOzR6GdcOxMGaVxvfje+fujCAlCtO1BP+A9/FS3KcPgCYG1wtAPwA5IAf\nHylL3TsUVIJQFBgiBr6N4Bgapr9eloaFfeYIBRsXmxPKAMJivqxYpLh0V3N4ZFd5\nTGqSEAa4b1ULDr6p0sB2L3QikTdsF0zp03zNceKA6fXDOzD0xWtg9buXvyKwePK4\nM2kcnWBNfsWghrdg0fG3O9bmkaS1oEXydrmJfuiI8h6a64J/1nzooi2yLC9D6Ta0\nS63bbuAHymnQtiNuV7Ixp6IoTGFaS88aTiHaP8rdyWV8JTDFx0qeDzyaGWiYGwEF\nmj/buHCEcRhoajbGkPhYA4YEdn4jy1wZhEr2OMdBPM7mPPI0Hy3hcNJVMVVlrpHe\nIltQATpjlNaJMlRPjbcaiW7dsO3BuF9ZOMGksSOnyYm/AgMBAAE=\n-----END PUBLIC KEY-----",
  "events": [
    "purchase.created"
  ],
  "callback": "https://example.com"
}
delete/webhooks/{id}/

Delete a webhook by ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 204

OK

curl -X DELETE "https://gate.safari.tech/api/v1/webhooks/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY"
get/webhooks/deliveries/

List webhook deliveries for a specific object.

Returns a paginated list of webhook deliveries for a specific source object (Purchase, Payment, Payout, or BillingTemplateClient). You must provide both `id` and `source_type` query parameters to identify the object whose webhook deliveries you want to retrieve. Deliveries show the complete history of webhook attempts for the specified object, including successful deliveries, failures, and retries.

Query parameters

idstring<uuid>required

ID of the source object (Purchase, Payment, Payout, or BillingTemplateClient) to retrieve webhook deliveries for.

source_typestringrequired

Type of the source object.

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/webhooks/deliveries/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "next": null,
  "previous": null,
  "results": [
    {
      "created_on": "2025-08-19T07:29:25.612314Z",
      "delivered_on": null,
      "attempts": 0,
      "delivery_attempts": [],
      "url": "https://example.com/webhook",
      "event": "purchase.created",
      "payload": {
        "example": "value"
      }
    }
  ]
}
Resource

Payment methods

1 endpoint

get/payment_methods/

Get the list of payment methods available for your purchase.

Send this request providing, at the very least, the `brand_id` and `currency` query parameters having the same values you'd use to create your Purchase. Be sure to use the same API key you'll create your Purchase with; it will define the test_mode setting used in the lookup. In the response body you'll receive an object with `available_payment_methods` property containing the list of payment method names available to use with your Purchase (e.g. those codes can be used in `payment_method_whitelist` field or with `?preferred={payment_method}` option of `checkout_url`). Please note that all lo…

Query parameters

brand_idstringrequired

Which brand would you like to lookup the available payment methods for. Use the same value (UUID) you'd set the `Purchase.brand_id` to.

currencystringrequired

Currency you'd use in your Purchase in ISO 4217 format, e.g. `EUR`.

countrystring

Country code in the ISO 3166-1 alpha-2 format (e.g. `GB`). Optional.

recurringboolean

If provided in the format of `recurring=true`, will filter out the methods that don't support recurring charges (see `POST /purchases/{id}/charge/`).

skip_captureboolean

If provided in the format of `skip_capture=true`, will filter out the methods that don't support `skip_capture` functionality (see the description for `Purchase.skip_capture field`).

preauthorizationboolean

If provided in the format of `preauthorization=true`, will filter out the methods that don't support preauthorization functionality (see the description for `Purchase.skip_capture field`).

languagestring

Language code in the ISO 639-1 format (e.g. 'en'). Optional.

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/payment_methods/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "available_payment_methods": [
    "visa",
    "mastercard",
    "some_method"
  ],
  "by_country": {
    "any": [
      "card"
    ],
    "GB": [
      "some_method"
    ]
  },
  "country_names": {
    "any": "Other",
    "GB": "United Kingdom"
  },
  "names": {
    "visa": "Visa",
    "mastercard": "Mastercard",
    "some_method": "Some method"
  },
  "logos": {
    "some_method": [
      "/static/images/icon-visa.svg",
      "/static/images/icon-mastercard.svg",
      "/static/images/icon-maestro.svg"
    ],
    "visa": "/static/images/icon-visa.svg",
    "mastercard": "/static/images/icon-mastercard.svg"
  },
  "card_methods": [
    "american_express",
    "visa"
  ]
}
Resource

Payout methods

1 endpoint

get/payout_methods/

Get the list of payout methods available for your payout.

Send this request providing, at the very least, the `brand_id` and `currency` query parameters having the same values you'd use to create your Payout. Be sure to use the same API key you'll create your Payout with; it will define the test_mode setting used in the lookup. In the response body you'll receive an object with `available_payout_methods` property containing the list of payout method names available to use with your Payout (e.g. those codes can be used in `payout_method_whitelist` field). Please note that all lookup arguments must be provided via query parameters after the endpoint,…

Query parameters

brand_idstringrequired

Which brand would you like to lookup the available payout methods for. Use the same value (UUID) you'd set the `Payout.brand_id` to.

currencystringrequired

Currency you'd use in your Payout in ISO 4217 format, e.g. `EUR`.

languagestring

Language code in the ISO 639-1 format (e.g. 'en'). Optional.

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/payout_methods/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "available_payout_methods": [
    "visa",
    "mastercard",
    "some_method"
  ],
  "names": {
    "visa": "Visa",
    "mastercard": "Mastercard",
    "some_method": "Some method"
  },
  "logos": {
    "some_method": [
      "/static/images/icon-visa.svg",
      "/static/images/icon-mastercard.svg",
      "/static/images/icon-maestro.svg"
    ],
    "visa": "/static/images/icon-visa.svg",
    "mastercard": "/static/images/icon-mastercard.svg"
  },
  "card_methods": [
    "american_express",
    "visa"
  ]
}
Resource

Account

2 endpoints

get/account/json/balance/

Get company balance.

Returns the company balance according to the provided query string filters. Multiple values can be provided for all filters except `from` and `to`, including all results matching any of these values.

Query parameters

frominteger

Retrieve a past balance value at a specific Unix timestamp

Response · 200

Company balance successfully retrieved

curl -X GET "https://gate.safari.tech/api/v1/account/json/balance/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "EUR": {
    "balance": 93408,
    "fee_sell": 0,
    "reserved": 0,
    "gross_balance": 93408,
    "pending_outgoing": 0,
    "available_balance": 93408
  },
  "RUB": {
    "balance": 1111840,
    "fee_sell": 360,
    "reserved": 0,
    "gross_balance": 1112200,
    "pending_outgoing": 0,
    "available_balance": 1111840
  },
  "USD": {
    "balance": -35420,
    "fee_sell": 1880,
    "reserved": 0,
    "gross_balance": -33540,
    "pending_outgoing": 0,
    "available_balance": -35420
  }
}
get/account/json/turnover/

Get company turnover.

Fetches the company turnover according to the provided query string filters. Must provide exactly one `currency` filter. Multiple values can be provided for all filters except `currency`, `from` and `to`, including all results matching any of these values.

Response · 200

Company turnover successfully retrieved

curl -X GET "https://gate.safari.tech/api/v1/account/json/turnover/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "incoming": {
    "turnover": 93408,
    "fee_sell": 1750,
    "count": {
      "all": 175
    }
  },
  "outgoing": {
    "turnover": 93408,
    "fee_sell": 1750,
    "count": {
      "all": 175
    }
  }
}
Resource

Balance

1 endpoint

get/balance/

Get balance data.

Returns balance data, including ecommerce and bank accounts.

Response · 200

Balance data successfully retrieved

curl -X GET "https://gate.safari.tech/api/v1/balance/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "ecommerce": [
    {
      "currency": "GBP",
      "gross_balance": 3232409,
      "balance": 3232409,
      "available_balance": 3185444,
      "reserved": 0,
      "pending_outgoing": 46965,
      "fee_sell": 0,
      "payout_gross_balance": 0,
      "payout_balance": 0,
      "available_payout_balance": 0,
      "pending_payouts": 0,
      "payout_overdraft": 0,
      "payout_fee_sell": 0
    },
    {
      "currency": "USD",
      "gross_balance": 3827891,
      "balance": 3827891,
      "available_balance": 3802744,
      "reserved": 0,
      "pending_outgoing": 25147,
      "fee_sell": 0,
      "payout_gross_balance": 0,
      "payout_balance": 0,
      "available_payout_balance": 0,
      "pending_payouts": 0,
      "payout_overdraft": 0,
      "payout_fee_sell": 0
    },
    {
      "currency": "EUR",
      "gross_balance": 7763713,
      "balance": 7763713,
      "available_balance": 7729281,
      "reserved": 0,
      "pending_outgoing": 34432,
      "fee_sell": 0,
      "payout_gross_balance": 0,
      "payout_balance": 0,
      "available_payout_balance": 0,
      "pending_payouts": 0,
      "payout_overdraft": 0,
      "payout_fee_sell": 0
    }
  ],
  "bank_accounts": [
    {
      "id": "9088acbc-54e5-4ff0-8b94-d08f855aa09c",
      "iban": "GB29NWBK60161331926819",
      "swift": "SPELGB11",
      "bank_account": "TEST",
      "bank_code": "SG0000000001",
      "real_bank_account": "GB29NWBK60161331926819",
      "real_bank_code": "SPELGB11",
      "currency": "GBP",
      "status": "active",
      "name": "",
      "reference": "SPELGB11",
      "available_balance": 9996003,
      "reserved_balance": 3385,
      "extended_ui": null,
      "fx_currencies": [
        "EUR",
        "USD",
        "GBP"
      ]
    },
    {
      "id": "d6f63e07-4954-42e0-a87c-45167bd2e401",
      "iban": "DE00SPEL00000000005882",
      "swift": "SPELDE66",
      "bank_account": "",
      "bank_code": "",
      "real_bank_account": "DE00SPEL00000000005882",
      "real_bank_code": "SPELDE66",
      "currency": "EUR",
      "status": "active",
      "name": "Account 1",
      "reference": null,
      "available_balance": 12567256,
      "reserved_balance": 0,
      "extended_ui": null,
      "fx_currencies": []
    }
  ],
  "payout_balances_enabled": {
    "EUR": false,
    "GBP": false,
    "USD": false
  }
}
Resource

Company Statements

4 endpoints

get/company_statements/

List all generated statements.

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/company_statements/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "results": [
    {
      "format": "string",
      "timezone": "Europe/Oslo"
    }
  ],
  "next": "string",
  "previous": "string"
}
post/company_statements/

Schedule a statement generation.

With this request, you can schedule a statement generation for a company. In a response, you will get an object with the following structure. Main fields to look out for here are `id`, `status` and `download_url`.

Request body

formatstring

Statement format, available formats: `csv`, `xlsx`.

timezonestring<TZ database name>

Timezone to localize statement-specific timestamps

is_testbooleanread-only

Indicates this is a test object, created using test API keys or using Billing section of UI while in test mode.

company_uidstring<uuid>read-only

ID of the Company.

query_stringstringread-only

Query parameters used to generate statement.

statusstringread-only

Status of statement generation e.g. `pending`, `processing`, `success`.

download_urlstringread-only

Download URL of a statement.

began_onUnixTimestampread-only

Date and time for the beginning of statement generation process.

finished_onUnixTimestampread-only

Date and time for finishing the statement generation process.

created_onUnixTimestampread-only

Object creation time

updated_onUnixTimestampread-only

Object last modification time

typestringread-only

Statement request type

idstring<uuid>read-only

ID of a statement

Response · 201

OK

curl -X POST "https://gate.safari.tech/api/v1/company_statements/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "csv",
    "timezone": "UTC"
  }'
Response
{
  "format": "string",
  "timezone": "Europe/Oslo"
}
get/company_statements/{id}/

Retrieve a statement by ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 200

OK

curl -X GET "https://gate.safari.tech/api/v1/company_statements/{id}/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "format": "string",
  "timezone": "Europe/Oslo"
}
post/company_statements/{id}/cancel/

Cancel a statement generation by ID.

Path parameters

idstring<uuid>required

Object ID (UUID)

Response · 200

OK

curl -X POST "https://gate.safari.tech/api/v1/company_statements/{id}/cancel/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "format": "string",
  "timezone": "Europe/Oslo"
}
Resource

Public Key

1 endpoint

get/public_key/

Get a callback public key.

Returns public key for authenticating company callback payloads

Response · 200

Public key for authenticating callback payloads

curl -X GET "https://gate.safari.tech/api/v1/public_key/" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
"-----BEGIN PUBLIC KEY-----\nMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA6gLlBKxCB5dxPJbinCzl\nhOfKSgQtOWQQBxmnWIkEVUbqhpnqr3xNYiAvDyMUxYUwuzN44eHO+mR9MZWcSx3c\nbXmKa3gsOzR6GdcOxMGaVxvfje+fujCAlCtO1BP+A9/FS3KcPgCYG1wtAPwA5IAf\nHylL3TsUVIJQFBgiBr6N4Bgapr9eloaFfeYIBRsXmxPKAMJivqxYpLh0V3N4ZFd5\nTGqSEAa4b1ULDr6p0sB2L3QikTdsF0zp03zNceKA6fXDOzD0xWtg9buXvyKwePK4\nM2kcnWBNfsWghrdg0fG3O9bmkaS1oEXydrmJfuiI8h6a64J/1nzooi2yLC9D6Ta0\nS63bbuAHymnQtiNuV7Ixp6IoTGFaS88aTiHaP8rdyWV8JTDFx0qeDzyaGWiYGwEF\nmj/buHCEcRhoajbGkPhYA4YEdn4jy1wZhEr2OMdBPM7mPPI0Hy3hcNJVMVVlrpHe\nIltQATpjlNaJMlRPjbcaiW7dsO3BuF9ZOMGksSOnyYm/AgMBAAE=\n-----END PUBLIC KEY-----"

Ready to integrate?

Get an API key, test with sandbox cards, and go live the same week. Our solutions team is on call.