POST https://gate.reviopay.com/api/v1/billing/Description
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 are read-only for POST /billing/.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
clients | BillingTemplateClient[] | yes | |
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. |
Example
curl -X POST https://gate.reviopay.com/api/v1/billing/ \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
-H 'Content-Type: application/json'Responses
| Status | Description |
|---|---|
200 | OK |
400 | Invalid data submitted or request processing error |