How it works
- Your server creates a payment session with a
subscriptionobject, using your secret key.amountis your price for one period. - The customer pays the first period on the Payviox payment page, with a card, Apple Pay or Google Pay. This payment goes through the usual fraud checks, the customer explicitly authorizes the recurring charge, and the card is saved for the renewals.
- When the first payment succeeds, Payviox creates the subscription (
psub_...) and sends you asucceededwebhook with asubscriptionblock. - Payviox then sets up a Stripe Billing subscription on your own Stripe account, starting at the end of the paid period. Stripe charges each renewal automatically — the money lands on your Stripe account, as for your one-time Stripe payments.
- Each renewal reaches you as a new
succeededwebhook, withorder_id={your order_id}-{cycle}. Failed renewals and cancellations have their own events. - The customer can cancel at the end of the paid period from a self-service link; you can cancel or resume from your backend or from the dashboard.
Before you start
Connect Stripe with card or wallets
Subscriptions are charged with Stripe, on your account:- In the Payviox dashboard, Providers → Stripe must be connected (publishable key, secret key and webhook signing secret) — the same setup as for one-time Stripe payments.
- At least one of these methods must be active: card (
stripe_credit), Apple Pay (stripe_apple_pay), Google Pay (stripe_google_pay). They’re the only methods offered on the payment page of a subscription.
payviox_subscription_id).Enable the Stripe renewal events
Renewals happen on Stripe, so Payviox learns about them through the Stripe webhook endpoint you set up for Payviox:https://api.payviox.com/payment/stripe/webhook. Add these five events to it:
Open your webhook endpoints in Stripe
Open the Payviox endpoint
https://api.payviox.com/payment/stripe/webhook — the one you created when you connected Stripe to Payviox. It must be enabled: a disabled endpoint counts as missing.Add the five events
invoice.paid, invoice.payment_failed, invoice.payment_action_required, customer.subscription.updated and customer.subscription.deleted.Save
No Payviox endpoint in Stripe yet?
No Payviox endpoint in Stripe yet?
https://api.payviox.com/payment/stripe/webhook, select the payment_intent.* events plus the five events above, then copy its signing secret (whsec_...) into Providers → Stripe in the Payviox dashboard.subscription_setup_incomplete and the list of missing_events, and the Subscriptions page of your dashboard shows a warning. The result is cached for up to an hour.Turn on the subscription webhooks in Payviox
In the Payviox dashboard, Developers → Webhooks, select the opt-in eventssubscription_payment_failed and subscription_canceled next to succeeded. See Webhook Integration if you don’t receive Payviox webhooks yet.
Create a subscription session
Subscriptions follow the recommended integration: your backend creates the session with the secret key, the browser opens it with the SDK. A subscription session can’t be created with the public key — the recurring price must never come from the browser.Your server creates the session
subscription to a regular Create Session request. amount and items describe one period.interval is day, week, month or year; interval_count (default 1) multiplies it — { "interval": "month", "interval_count": 3 } bills every quarter. A period can’t exceed 3 years.The browser opens it with the SDK
https://secure.payviox.com/{session_id} yourself.amount plus the fees your account adds for the customer, exactly as for a one-time payment. The amount charged today can be slightly higher than the renewals: one-time add-on fees (such as fraud screening) only apply to the first payment. The renewal price is fixed at signup and returned as unit_amount on the Subscription object.Handle the webhooks
The customer coming back to your site isn’t a confirmation — webhooks are. Keep one rule: give access until the end of the last period you were paid for.- Idempotency: deduplicate on
order_id+type, as for one-time payments. Each cycle has its ownorder_id(order_12345,order_12345-2, …), so renewals never collide. - Fraud review: the first payment can be
pending_reviewbeforesucceeded— don’t give access yet. Renewals aren’t reviewed: they arrive directly assucceeded. - Failed renewals: you get one
subscription_payment_failedper cycle, even if Stripe retries several times. Itssubscription.current_period_endis the end of the period that wasn’t paid — don’t extend access from it. If a retry succeeds, you receivesucceededwith the sameorder_id. The retry schedule, and what happens when all retries fail, are set in your Stripe Billing settings (failed payments / revenue recovery): we recommend canceling the subscription, so you receivesubscription_canceled. If Stripe leaves it unpaid instead, it stayspast_duein Payviox and no further event is sent. authentication_required: the bank wants the customer to approve the renewal (3D Secure), which Stripe retries alone can’t solve. Payviox doesn’t contact the customer: enable Stripe’s emails with a hosted confirmation link for payments that require 3D Secure in your Stripe Billing settings, or ask the customer to subscribe again.- Cancellation: scheduling a cancellation (by you or the customer) sends no event —
subscription_canceledarrives when the subscription actually ends. It’s attached to the signup payment (order_id= your original one,cycle=1): identify the subscription withsubscription.id. When you cancel immediately yourself, it’s your call whether access ends now or at the end of the paid period.
Let customers manage their subscription
Every subscription has amanagement_url (in the webhook subscription block and on the Subscription object). It opens a Payviox page where the customer can:
- see the price, the next payment date and the card used;
- cancel at the end of the paid period — they keep what they paid for;
- undo their own cancellation before the period ends. If you scheduled the cancellation, the page tells them to contact you instead.
subscription.management_url from the succeeded webhook in your confirmation email, and show it in your account page. That’s the reliable channel — Payviox doesn’t email it, and the checkout success screen only shows it when the payment succeeds right away: if the signup payment goes to fraud review (pending_review), the subscription and its link only exist once the payment is succeeded, after the customer has left the page. Customers can’t change their card, switch plans or cancel immediately from this page.
Cancel or resume from your backend
Use the Subscriptions API with your secret key, or the Subscriptions page of your dashboard (team members need the Cancel and resume subscriptions permission).- Cancel now (
at_period_end: false) also voids the subscription’s unpaid Stripe invoices, so no pending retry can charge the customer afterwards. There’s no automatic refund. - Resume only works on a cancellation scheduled on your side (
cancel_requested_byapi,manager, ornullfor one scheduled from your Stripe dashboard). A cancellation scheduled by the customer (payer) can only be undone by the customer, from their management link; one scheduled by Payviox (admin,system) requires support. Both return403. The customer’s cancellation withdraws their consent to be charged: renewing anyway would be an unauthorized charge, the typical cause of “canceled recurring payment” disputes.
List Subscriptions
status (active, past_due, canceled, canceling) or customerGet Subscription
Cancel Subscription
Resume Subscription
Limits
- USD only, like every Payviox session. Minimum
100cents per period. - Card, Apple Pay and Google Pay through Stripe only. Other providers and local methods aren’t offered for subscriptions.
- No free trial: the first period is charged when the customer subscribes.
- No plan catalog: price and interval are set per session. To change a customer’s price or interval, cancel at period end and have them subscribe again with a new session — there’s no upgrade or proration.
- Intervals up to 3 years: 1095 days, 156 weeks, 36 months or 3 years per period.
- The customer can’t update their card. If it expires or keeps being declined, renewals fail; once the subscription is canceled, invite the customer to subscribe again.
- Fraud screening applies to the signup payment only, not to renewals.
Test your integration
- Connect Stripe in Payviox with your Stripe test-mode keys and test-mode webhook signing secret, and enable the five events on the test-mode endpoint.
- Create a subscription session with
{ "interval": "day", "interval_count": 1 }so the first renewal happens one day later. - Pay with a Stripe test card:
4242 4242 4242 4242— signup and renewals succeed.4000 0027 6000 3184— requires authentication on every charge: the signup succeeds after you complete the test authentication, and the renewal fails withfailure_reason: "authentication_required".
- Check that you received
succeededwithsubscription.cycle: 1, then fetch the subscription with Get Subscription:provider_subscription_idis filled within about a minute, and the subscription shows up in your Stripe dashboard (test mode). - Open the
management_url, cancel, then undo — and checkcancel_at_period_endwith the API.
Troubleshooting
403 subscription_requires_secret_key
403 subscription_requires_secret_key
createSession()). Create it from your server with your secret key, then open it with openSession().400 subscription_setup_incomplete
400 subscription_setup_incomplete
https://api.payviox.com/payment/stripe/webhook is missing, or lacks the events listed in missing_events. Add them in the right mode (test or live). The check is cached for up to an hour, so the error can persist briefly after you fix it.400 No payment method that supports subscriptions
400 No payment method that supports subscriptions
paymentMethodId, it must be one of these methods.403 when resuming a subscription
403 when resuming a subscription
cancel_requested_by: "payer") — only they can undo it, from their management link — or by Payviox (admin, system) — contact support.The subscription was canceled right after signup (setup_failed)
The subscription was canceled right after signup (setup_failed)
canceled_by: "system", cancellation_reason setup_failed:<code>) and you received subscription_canceled. Contact support@payviox.com with the subscription ID.Renewals are charged on Stripe but I get no webhook
Renewals are charged on Stripe but I get no webhook
succeeded is selected in your Payviox webhook settings.