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 subscription_charge_period_end == false and subscription_trial_periods == 0 (first billing should occur today), the request will create a BillingTemplateClient with status == pending and create a Purchase. When such a Purchase is paid, the respective BillingTemplateClient will have its' subscription activated (starting from the day of payment), with its status changing to active. Successful response will be of form {billing_template_client: <BillingTemplateClient object created>, purchase: <Purchase object created>}: you should redirect your client to purchase.checkout_url for him to pay immediately (as you do with POST /purchases/).
ApiKeyAuthorizationBearer <token>Your API key from the Developers section of your account, sent as a bearer token.
id*stringObject ID (UUID)
uuidapplication/json- body
Connects a Client object to a BillingTemplate having is_subscription = true to store information about a single subscriber.
You will be able to pause an individual subscription client's cycle by PATCH-ing its' status field to the value of subscription_paused.
client_id*stringID 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.
uuidinvoice_reference?|When present overrides reference for invoices generated for this client
length <= 128status?stringFor 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 a day before the billing date, the next day the invoice will not be issued; but, if you unpause the client a day after the planned billing would have taken place, the planned billing in a month (minus one day) will happen as usual.
Read-only if the BillingTemplateClient is in inactive (internal status not managed through public API) or pending (see documentation for POST /billing_templates/{id}/add_subscriber/) statuses.
"inactive""pending""inactive""active""subscription_paused"payment_method_whitelist?array<>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).
1 <= itemssend_invoice_on_charge_failure?booleanSends invoice when subscription charge fails if this is true
truesend_invoice_on_add_subscriber?booleanSends invoice when POST /billing_templates/{id}/add_subscriber/ is called if this is true
falsesend_receipt?booleanSends receipt when subscription charge succeeds if this is true
trueOK
response?unknownapplication/jsoncurl -X POST 'https://gate.reviopay.com/api/v1/billing_templates/497f6eca-6276-4993-bfeb-53cbbbba6f08/add_subscriber/' \ -H 'Content-Type: application/json' \ -d '{ "client_id": "b79d3df6-2f69-4426-acee-eda049d83e18"}'{ "billing_template_client": { "client_id": "5b3fa7ba-57d3-4017-a65b-d57dcd2db643", "number_of_billing_cycles_passed": 0, "invoice_reference": "string", "status": "pending", "subscription_billing_scheduled_on": null, "payment_method_whitelist": [ "string" ], "send_invoice_on_charge_failure": true, "send_invoice_on_add_subscriber": false, "send_receipt": true, "type": "string", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "created_on": 1619740800, "updated_on": 1619740800 }, "purchase": { "client": { "email": "user@example.com", "phone": "+44 45643564564", "full_name": "string", "personal_code": "string", "street_address": "string", "country": "st", "city": "string", "zip_code": "string", "state": "string", "shipping_street_address": "string", "shipping_country": "st", "shipping_city": "string", "shipping_zip_code": "string", "shipping_state": "string", "cc": [ "user@example.com" ], "bcc": [ "user@example.com" ], "legal_name": "string", "brand_name": "string", "registration_number": "string", "tax_number": "string", "delivery_methods": [ { "method": "email", "options": {} } ], "bank_account": "string", "bank_code": "string" }, "purchase": { "currency": "str", "products": [ { "name": "string", "quantity": 1, "price": 0, "discount": 0, "tax_percent": 0, "category": "string", "total_price_override": null } ], "total": null, "language": "Default value is controlled in Company -> Brand section of merchant portal separately per each Brand used (default value, if no changes are made, is `en`). Brand to be used with corresponding Purchase/BillingTemplate specified using brand_id.", "notes": "string", "debt": 0, "subtotal_override": null, "total_tax_override": null, "total_discount_override": null, "total_override": null, "request_client_details": [], "timezone": "Europe/Oslo", "due_strict": false, "email_message": "string", "metadata": {}, "single_attempt": false }, "payment": { "is_outgoing": false, "payment_type": "purchase", "amount": 0, "currency": "str", "net_amount": null, "fee_amount": null, "pending_amount": null, "pending_unfreeze_on": null, "description": "string", "paid_on": 1619740800, "remote_paid_on": 1619740800 }, "issuer_details": { "website": "string", "legal_street_address": "string", "legal_country": "st", "legal_city": "string", "legal_zip_code": "string", "bank_accounts": [ { "bank_account": "string", "bank_code": "string" } ], "legal_name": "string", "brand_name": "string", "registration_number": "string", "tax_number": "string" }, "transaction_data": { "payment_method": "string", "extra": {}, "country": "string", "attempts": [ { "type": "execute", "successful": true, "payment_method": "string", "extra": {}, "country": "string", "client_ip": "string", "processing_time": 1619740800, "error": { "code": "string", "message": "string" } } ] }, "status": "created", "status_history": [ { "status": "created", "timestamp": 1619740800, "related_object": { "type": "string", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08" } } ], "viewed_on": 1619740800, "company_id": "b2e6a1c3-1a5e-44ae-a8fd-81f76fd715cf", "is_test": true, "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", "brand_id": "1bb61461-e5e3-4ebb-8cc6-5b0c37f1b7da", "billing_template_id": "a8e1b11b-de6d-4fac-8355-ed4dae6d8c75", "client_id": null, "send_receipt": false, "is_recurring_token": true, "recurring_token": "ea8ccbd2-20f1-4adc-bf89-fbea200a7614", "skip_capture": false, "force_recurring": false, "reference_generated": "string", "reference": "string", "issued": "2020-04-30", "due": 1619740800, "refund_availability": "all", "refundable_amount": null, "currency_conversion": { "original_currency": "string", "original_amount": 0, "exchange_rate": 0 }, "payment_method_whitelist": [ "string" ], "success_redirect": "string", "failure_redirect": "string", "cancel_redirect": "string", "success_callback": "string", "creator_agent": "string", "platform": "web", "product": "purchases", "created_from_ip": "string", "source_platform": "string", "invoice_url": "string", "checkout_url": "string", "direct_post_url": "string", "marked_as_paid": true, "order_id": "string", "upsell_campaigns": [ "26b11f47-c6a7-4c09-b770-196490ac710e" ], "referral_campaign_id": "d2266e23-661a-4f4a-bd3d-2b530c5324d4", "referral_code": "string", "referral_code_generated": "string", "referral_code_details": { "campaign_id": "78614b6c-fe7c-41e2-8e25-c9b3a3c91904", "reward_type": "gift", "discount_amount": null, "discount_percent": 0.1 }, "retain_level_details": { "campaign_id": "78614b6c-fe7c-41e2-8e25-c9b3a3c91904", "discount_amount": null, "discount_percent": 0.1 }, "type": "string", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "created_on": 1619740800, "updated_on": 1619740800 }}