POST https://gate.reviopay.com/api/v1/billing_templates/Description
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 clients will receive recurring invoices (that will be paid for automatically if client saves their card) according to the BillingTemplate settings you have specified. If is_subscription is false, this BillingTemplate is used to send one-time invoices. After creating it and specifying invoice_* fields, use POST /billing_templates/{id}/send_invoice/ request to send the actual invoices. BillingTemplateClients for non-subscription BillingTemplates are not saved.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
title | string | no | |
is_test | boolean | no | Indicates this is a test object, created using test API keys or using Billing section of UI while in test mode. |
user_id | string (uuid) | no | ID of user who has created this object in the Billing UI, if applicable. |
brand_id | string (uuid) | no | 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?”. |
purchase | PurchaseDetails | yes | Core information about the Purchase, including the products, total, currency and invoice fields. |
company_id | string (uuid) | no | |
invoice_due | object | no | Sets due on the Purchase objects generated. Required if is_subscription == false, read-only otherwise. |
invoice_issued | object | no | Sets issued on the Purchase objects generated. Generated from current day in purchase.timezone if not provided. Read-only if is_subscription == true. |
force_recurring | boolean | no | 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. |
is_subscription | boolean | yes | 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. |
upsell_campaigns | string (uuid)[] | no | Array of IDs of related Upsell campaigns. |
subscription_active | boolean | no | 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… |
subscription_period | integer | no | 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". |
invoice_send_receipt | boolean | no | 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. |
invoice_skip_capture | boolean | no | Sets skip_capture on the Purchase objects generated. false by default. Read-only if is_subscription == true. |
referral_campaign_id | string (uuid) | no | ID of Referral campaign. |
subscription_due_period | integer | no | 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… |
number_of_billing_cycles | integer | no | Limits number of billing cycles for each client if set to a non-zero value |
subscription_period_units | object | no | See subscription_period. |
subscription_trial_periods | integer | no | 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… |
subscription_due_period_units | object | no | See subscription_due_period. |
subscription_charge_period_end | boolean | no | If this is true, clients are charged at the end of billing periods, and vice-versa. E.g. |
subscription_has_active_clients | boolean | no | 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. |
id | string (uuid) | no | |
type | string | no | Object type identifier |
created_on | object | no | Object creation time |
updated_on | object | no | Object last modification time |
Example
curl -X POST https://gate.reviopay.com/api/v1/billing_templates/ \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
-H 'Content-Type: application/json'Responses
| Status | Description |
|---|---|
201 | OK |
400 | Invalid data submitted or request processing error |