DevelopersAccept payments
Subscriptions
Sell a recurring USDC price with a subscription session, follow the subscription's status, and cancel it from your server.
How do I set up recurring USDC payments on Solana?
A subscription charges the payer the same price every 30 or 365 days, on Solana. Your server starts
it with a checkout session in mode: subscription, Fianto charges each renewal, and your server
follows along through webhooks. On your own site subscriptions need the API; without code, a merchant's payment link or shop can sell a
recurring price too.
When the merchant has card subscriptions on, the payer can also subscribe by card, when the price, and its discounted price if a code applies, is whole cents from $1.00 to $999,999.99: see Card subscriptions. This page describes the crypto flow.
Scroll sideways to see the whole diagram →
Show as text
- A subscription starts `ACTIVE`; the first period is charged inside the subscribe transaction.
- Fianto charges each renewal every 30 days or every 365 days, as the price sets.
- The first counted failed renewal moves it to `PAST_DUE`; a later successful retry moves it back to `ACTIVE`.
- The 4th counted failure ends it: `ENDED` with reason `PAYMENT_FAILED`.
- From `ACTIVE` or `PAST_DUE`, a payer cancel ends it at the current period end with reason `PAYER_CANCELED`; a merchant cancel ends it now or at period end with reason `MERCHANT_CANCELED`: Fianto stops charging (a charge already in flight can still land), but the payer's on-chain subscription stays live.
- Re-subscribing ends the old subscription with `PAYER_CANCELED`.
- No back-billing: missed periods are never billed.
Before you start
- Your merchant account is approved, and you have an application's app id and secret.
- You can already create checkout sessions. See Checkout sessions.
- You have a webhook route. Subscriptions are followed only through events and reads; a subscription session creates no order.
Steps
Create a recurring price in the dashboard
Add a product and give it a recurring price. A recurring price charges every 30 days or every
365 days. Prices are never edited: to change one, add a new price. Ending the old price cancels its subscribers at the end of
their current period. Copy the price's id (fian_price_…) from the prices table.
Create a subscription session
Send mode: subscription and the recurring price_id. Leave out amount and description: the
price sets the amount, and its product's name becomes the session's description. order_id,
success_url and cancel_url are required, as for a one-time payment.
curl https://api.fianto.xyz/v1/checkout-sessions \
--user "$FIANTO_APP_ID:$FIANTO_APP_SECRET" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: signup-user_42-1" \
-d '{
"mode": "subscription",
"order_id": "signup_user_42",
"price_id": "fian_price_...",
"success_url": "https://shop.example/welcome",
"cancel_url": "https://shop.example/pricing"
}'The url, reissue, cancel and redirect or popup rules are the same as for
one-time sessions.
Let the plan get ready
Each price gets a plan on Solana, created by the first subscription session for that price. Fianto
signs that transaction and pays its rent. Until the plan is on chain, the hosted checkout page shows
it as preparing (plan_status: preparing) and no pay button. Fianto retries a failed plan creation
after 30 seconds, 2 minutes, 10 minutes and 1 hour, then marks it failed.
A plan is tied to the price, your receiving wallet, the service fee and the network fee. If a fee or your wallet changes, new subscribers get a new plan; existing subscribers keep paying the old wallet and fees. Fianto creates at most 50 new plans per merchant in any 24 hours. In Test mode, an account not yet approved can create at most 5, and all such accounts share a total of 200.
Follow the subscription through webhooks
Fianto sends subscription. when the subscribe transaction finalizes. Give access there.
Then keep your records in step with the other events:
| Event | When |
|---|---|
subscription. | A renewal was charged |
subscription. | A renewal charge had a counted failure |
subscription. | The first counted failure moved the subscription to PAST_DUE |
subscription. | A cancel at the end of the period was scheduled |
subscription. | A scheduled cancel was withdrawn |
subscription.ended | The subscription ended |
A subscription is ACTIVE, PAST_DUE or ENDED. It moves between ACTIVE and PAST_DUE as
renewals fail and succeed, and it ends when the payer cancels, you cancel, or the 4th counted renewal
failure ends it with end_reason PAYMENT_FAILED. ENDED is final.
Cancel from your server
Cancel with POST /v1/ and at:
nowends the subscription at once and sendssubscription.ended.period_endstops it at the end of the current period and sendssubscription., unless a cancel is already scheduled: then it sends no second event. If the payer scheduled that cancel, your request still setscancel_ scheduled merchant_tocancel_ requested true(thecancel_reasonstaysPAYER_CANCELED), so your cancel stands even if the payer resumes the subscription on Solana.
curl https://api.fianto.xyz/v1/subscriptions/SUBSCRIPTION_ID/cancel \
--user "$FIANTO_APP_ID:$FIANTO_APP_SECRET" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: cancel-SUBSCRIPTION_ID-1" \
-d '{ "at": "period_end" }'A cancel is final and changes nothing on Solana
A cancel only stops Fianto from charging. It cannot be undone, and it does not end the payer's
subscription on Solana, which stays live. With now, a renewal charge already in flight can still
land. The v1 API has no refund endpoint: refund a crypto payer by sending USDC from your wallet yourself.
What the payer sees after your cancel: while a period_end cancel is pending, the payer portal offers
no cancel of its own. Because the on-chain subscription stays live, the same wallet cannot subscribe
to the same plan again until the payer uses "Cancel on Solana" in the portal and that period on
Solana has ended; Fianto then closes the subscription's account itself.
What the payer pays
When subscribing, the payer pays the first period's price, plus the service fee and the plan's
network fee in USDC when they are above zero. Fianto pays the Solana network fee and the rent for the
accounts the subscribe transaction creates, so the payer needs no SOL. Each renewal takes the same
total again; Fianto pays the Solana network fee for renewals. The network fee
is fixed per plan when the plan is created (currently 0.01 USDC; none on plans created before it).
On the session and the subscription, total_amount is amount + fee_amount +
network_fee_amount: what each charge takes. See Fees.
Discount codes
A payer can type a merchant's discount code on a subscription's checkout page. The coupon's duration decides which charges are discounted: the first only, the first N, or every charge; later charges are at the full price. Your server only reads the result:
- On the subscription session, as on a payment session,
amountis the discounted first charge,list_amountthe price before the discount anddiscount_amountwhat the code took off. See Checkout sessions. - On the subscription (v1 and
subscription.*events),amount,fee_amount,total_amountandlist_amountkeep the plan's full-price terms.discount_amountis taken off the price of each discounted charge, anddiscountisnullor{ "code", "duration", "periods" }, wheredurationis"once","repeating"(withperiods, the number of discounted charges) or"forever". A discount of one charge always reads"once". - On renewal events,
period.amount_dueis the discounted price while the discount lasts, then the full price;period.fee_duefollows it.
So while a discount lasts, a charge takes less than the subscription's total_amount. The payer's
wallet approves the full price as the most each period can take. On webhook payloads list_amount,
discount_amount and discount are missing on events created before discount codes (October 2026).
Check it worked
After a payer subscribes and the transaction finalizes, your webhook route receives
subscription., and the subscription is listed by GET /v1/subscriptions:
curl "https://api.fianto.xyz/v1/subscriptions?limit=5" \
--user "$FIANTO_APP_ID:$FIANTO_APP_SECRET"Its status is ACTIVE. After a cancel at period_end, cancel_ is true; after a
cancel at now, status is ENDED.
Troubleshooting
| You see | Why | Fix |
|---|---|---|
400 price_id_required | A subscription session was sent without price_id. | Send the recurring price's fian_price_… id. |
400 amount_not_allowed | The session sent amount or description. | Remove both; the price and its product set them. |
422 price_not_recurring | The price is one-time. | Use a recurring price, or send mode: payment. |
422 price_ended or product_ended | The price, or its product, has been ended in the dashboard. | Send the fian_price_… id of an active recurring price. |
503 subscriptions_ | Fianto has paused new subscriptions. Existing subscriptions are unaffected. | Try again later. |
409 order_id_in_use | This order_id already belongs to a completed subscription session. | Use a new order_id for each subscription session. |
429 plan_limit_reached | The session needed a new plan and your account already created 50 new plans in the last 24 hours. | Try again later. |
The checkout page shows the plan as preparing (subscription_) | The first session for this price is creating its plan on Solana. | Wait. The payer can pay once the plan is on chain. |
The checkout page cannot start the subscription (subscription_) | Creating the plan failed after every retry, or you ended the price while the session was open. | For a failed plan, create a new subscription checkout session for the price: it starts a new plan attempt. If that fails too, write to support@fianto.xyz. For an ended price, use an active one. |
409 subscription_ | You cancelled a subscription that has already ended. | Nothing to do. Read it to see its end_reason. |
503 subscription_busy on a cancel | Another request was changing this subscription at the same moment. Nothing was changed. | Retry with the same Idempotency-Key; the SDK retries it for you. |
400 validation_failed with field: "at" | at is missing, or is not now or period_end. | Send one of the two. |
See also
Was this page helpful? Tell us
fianto.xyzCard payments
Offer card as well as crypto from your server. payment_methods, the error when no card can be offered, one handler for both rails, and refund totals.
Shop sales in your integration
How a merchant's shop sales reach your server through the Shop application's webhooks, how to recognise them, and why the API and SDK are unchanged.