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 are read-only for POST /billing/.
ApiKeyAuthorizationBearer <token>Your API key from the Developers section of your account, sent as a bearer token.
application/json- body
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.
clients*array<>purchase*PurchaseDetailsCore 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).
number_of_billing_cycles?integerLimits number of billing cycles for each client if set to a non-zero value
brand_id?stringID 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?".
uuidtitle?stringlength <= 256is_subscription*booleanDefines 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_issued?|Sets issued on the Purchase objects generated. Generated from current day in purchase.timezone if not provided. Read-only if is_subscription == true.
invoice_due?|Sets due on the Purchase objects generated. Required if is_subscription == false, read-only otherwise.
invoice_skip_capture?booleanSets skip_capture on the Purchase objects generated. false by default. Read-only if is_subscription == true.
falseinvoice_send_receipt?booleanSets 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.
falsesubscription_period?integerDefines 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 are 28 days in February that year - billing scheduled for February will happen on 28th.
Both fields are required when creating a BillingTemplate with is_subscription == true/editing a BillingTemplate with is_subscription == true as long as there aren't any launched subscribers; they are read-only otherwise, whether it's BillingTemplate's editing when there already are clients activated or if is_subscription == false.
1 <= value <= 2561subscription_period_units?stringSee subscription_period.
"months""days""weeks""months"subscription_due_period?integerUsed 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.
1 <= value <= 2567subscription_due_period_units?stringSee subscription_due_period.
"days""days""weeks""months"subscription_charge_period_end?booleanIf 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 BillingTemplate with is_subscription == true/editing a BillingTemplate with is_subscription == true as long as there aren't any launched subscribers; read-only otherwise, whether it's BillingTemplate's editing when there already are clients activated or if is_subscription == false.
falsesubscription_trial_periods?integerHow 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 launched for false, 4 for true). "subscription_trial_periods": 0 disables this feature.
Required when creating a BillingTemplate with is_subscription == true/editing a BillingTemplate with is_subscription == true as long as there aren't any launched subscribers; read-only otherwise, whether it's BillingTemplate's editing when there already are clients activated or if is_subscription == false.
0 <= value <= 2560subscription_active?booleanWhether 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.
falseforce_recurring?booleanIf 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.
falseupsell_campaigns?array<>Array of IDs of related Upsell campaigns.
referral_campaign_id?|ID of Referral campaign.
uuidOK
application/json- response
A list of Purchase IDs created.
[index: integer]?idObject ID (UUID)
curl -X POST 'https://gate.reviopay.com/api/v1/billing/' \ -H 'Content-Type: application/json' \ -d '{ "clients": [ { "client_id": "5b3fa7ba-57d3-4017-a65b-d57dcd2db643" } ], "purchase": { "products": [ { "name": "string", "price": 0 } ] }, "is_subscription": true}'[ "720e2c96-ef94-4baa-90b6-d61ef6fd675a"]