Works with Typestate. Built into Typestate.
Stripe
Take one-off payments, deposits and subscriptions on your own Stripe account.
Add Stripe payments to my backend on Typestate.
Stripe is on, through set_payment_provider.
Open a payment page, Open the billing page, Refund a payment
Your key goes on the cockpit, never through me.
Ready on Sandbox after the next deploy.
What it does for a business
- Sell a product or a plan on a Stripe payment page, and know the moment the money arrives
- Give access only after a payment succeeded, and take it away when a subscription ends
- Refund from an action, for example when an appointment is cancelled in time
- Let a customer change their card or cancel on Stripe's own billing page
- Add the buyer's tax with Stripe Tax, if you turn it on
Triggers
Events from Stripe that start an action of your backend.
WhenA payment succeededMoney arrived for a product sold once, or for the first period of a subscription.
| Field the action gets | Type | What it is |
|---|---|---|
event | text | Which event it is, such as payment.succeeded. |
id | text | The same for every run of one event, so an action can tell a repeat. |
person | text | The account of the person who paid, when they were signed in. |
product | text | The product's name, as it was declared. |
reference | text | What the action that opened the payment page gave as its reference, such as a booking's id. |
payment | text | The payment, for a refund. |
subscription | text | The subscription, for a subscription event. |
refund | text | The refund, for a refund event. |
status | text | The state after the event. |
amount | integer | How much, in the smallest unit of the currency (cents). |
currency | text | Three letters, such as EUR. |
An example
{
"amount": 2000,
"currency": "EUR",
"event": "payment.succeeded",
"id": "evt_8Fq2",
"payment": "pay_7Kd",
"person": "usr_41c",
"product": "Deposit",
"reference": "bkg_19",
"refund": null,
"status": "paid",
"subscription": null
}WhenA payment failedA card was refused, for example at a renewal.
| Field the action gets | Type | What it is |
|---|---|---|
event | text | Which event it is, such as payment.succeeded. |
id | text | The same for every run of one event, so an action can tell a repeat. |
person | text | The account of the person who paid, when they were signed in. |
product | text | The product's name, as it was declared. |
reference | text | What the action that opened the payment page gave as its reference, such as a booking's id. |
payment | text | The payment, for a refund. |
subscription | text | The subscription, for a subscription event. |
refund | text | The refund, for a refund event. |
status | text | The state after the event. |
amount | integer | How much, in the smallest unit of the currency (cents). |
currency | text | Three letters, such as EUR. |
An example
{
"amount": 2000,
"currency": "EUR",
"event": "payment.failed",
"id": "evt_8Fq2",
"payment": "pay_7Kd",
"person": "usr_41c",
"product": "Deposit",
"reference": "bkg_19",
"refund": null,
"status": "failed",
"subscription": null
}WhenA subscription startedA person began paying for a plan.
| Field the action gets | Type | What it is |
|---|---|---|
event | text | Which event it is, such as payment.succeeded. |
id | text | The same for every run of one event, so an action can tell a repeat. |
person | text | The account of the person who paid, when they were signed in. |
product | text | The product's name, as it was declared. |
reference | text | What the action that opened the payment page gave as its reference, such as a booking's id. |
payment | text | The payment, for a refund. |
subscription | text | The subscription, for a subscription event. |
refund | text | The refund, for a refund event. |
status | text | The state after the event. |
amount | integer | How much, in the smallest unit of the currency (cents). |
currency | text | Three letters, such as EUR. |
An example
{
"amount": 500,
"currency": "EUR",
"event": "subscription.started",
"id": "evt_8Fq2",
"payment": null,
"person": "usr_41c",
"product": "Monthly",
"reference": null,
"refund": null,
"status": "active",
"subscription": "sub_3Rb"
}WhenA subscription changedA person switched plan or quantity in the billing page.
| Field the action gets | Type | What it is |
|---|---|---|
event | text | Which event it is, such as payment.succeeded. |
id | text | The same for every run of one event, so an action can tell a repeat. |
person | text | The account of the person who paid, when they were signed in. |
product | text | The product's name, as it was declared. |
reference | text | What the action that opened the payment page gave as its reference, such as a booking's id. |
payment | text | The payment, for a refund. |
subscription | text | The subscription, for a subscription event. |
refund | text | The refund, for a refund event. |
status | text | The state after the event. |
amount | integer | How much, in the smallest unit of the currency (cents). |
currency | text | Three letters, such as EUR. |
An example
{
"amount": 500,
"currency": "EUR",
"event": "subscription.changed",
"id": "evt_8Fq2",
"payment": null,
"person": "usr_41c",
"product": "Monthly",
"reference": null,
"refund": null,
"status": "active",
"subscription": "sub_3Rb"
}WhenA subscription endedA person stopped paying. Every backend that sells a subscription names an action for this.
| Field the action gets | Type | What it is |
|---|---|---|
event | text | Which event it is, such as payment.succeeded. |
id | text | The same for every run of one event, so an action can tell a repeat. |
person | text | The account of the person who paid, when they were signed in. |
product | text | The product's name, as it was declared. |
reference | text | What the action that opened the payment page gave as its reference, such as a booking's id. |
payment | text | The payment, for a refund. |
subscription | text | The subscription, for a subscription event. |
refund | text | The refund, for a refund event. |
status | text | The state after the event. |
amount | integer | How much, in the smallest unit of the currency (cents). |
currency | text | Three letters, such as EUR. |
An example
{
"amount": 500,
"currency": "EUR",
"event": "subscription.ended",
"id": "evt_8Fq2",
"payment": null,
"person": "usr_41c",
"product": "Monthly",
"reference": null,
"refund": null,
"status": "ended",
"subscription": "sub_3Rb"
}WhenA trial ends in 3 daysTime to remind the person before the first payment.
| Field the action gets | Type | What it is |
|---|---|---|
event | text | Which event it is, such as payment.succeeded. |
id | text | The same for every run of one event, so an action can tell a repeat. |
person | text | The account of the person who paid, when they were signed in. |
product | text | The product's name, as it was declared. |
reference | text | What the action that opened the payment page gave as its reference, such as a booking's id. |
payment | text | The payment, for a refund. |
subscription | text | The subscription, for a subscription event. |
refund | text | The refund, for a refund event. |
status | text | The state after the event. |
amount | integer | How much, in the smallest unit of the currency (cents). |
currency | text | Three letters, such as EUR. |
An example
{
"amount": 500,
"currency": "EUR",
"event": "subscription.trial_ending",
"id": "evt_8Fq2",
"payment": null,
"person": "usr_41c",
"product": "Monthly",
"reference": null,
"refund": null,
"status": "trialing",
"subscription": "sub_3Rb"
}WhenA refund succeededMoney went back to the buyer.
| Field the action gets | Type | What it is |
|---|---|---|
event | text | Which event it is, such as payment.succeeded. |
id | text | The same for every run of one event, so an action can tell a repeat. |
person | text | The account of the person who paid, when they were signed in. |
product | text | The product's name, as it was declared. |
reference | text | What the action that opened the payment page gave as its reference, such as a booking's id. |
payment | text | The payment, for a refund. |
subscription | text | The subscription, for a subscription event. |
refund | text | The refund, for a refund event. |
status | text | The state after the event. |
amount | integer | How much, in the smallest unit of the currency (cents). |
currency | text | Three letters, such as EUR. |
An example
{
"amount": 2000,
"currency": "EUR",
"event": "refund.succeeded",
"id": "evt_8Fq2",
"payment": "pay_7Kd",
"person": "usr_41c",
"product": "Deposit",
"reference": "bkg_19",
"refund": "re_2Hs",
"status": "refunded",
"subscription": null
}WhenA refund failedA card refund could not go through, so the payment counts as paid again.
| Field the action gets | Type | What it is |
|---|---|---|
event | text | Which event it is, such as payment.succeeded. |
id | text | The same for every run of one event, so an action can tell a repeat. |
person | text | The account of the person who paid, when they were signed in. |
product | text | The product's name, as it was declared. |
reference | text | What the action that opened the payment page gave as its reference, such as a booking's id. |
payment | text | The payment, for a refund. |
subscription | text | The subscription, for a subscription event. |
refund | text | The refund, for a refund event. |
status | text | The state after the event. |
amount | integer | How much, in the smallest unit of the currency (cents). |
currency | text | Three letters, such as EUR. |
An example
{
"amount": 2000,
"currency": "EUR",
"event": "refund.failed",
"id": "evt_8Fq2",
"payment": "pay_7Kd",
"person": "usr_41c",
"product": "Deposit",
"reference": "bkg_19",
"refund": "re_2Hs",
"status": "paid",
"subscription": null
}Writes
What an action of your backend asks Stripe to do.
DoOpen a payment pageAnswers the address of Stripe's page for one product. No money moves until the person pays there.
| Parameter | Type | Needed | What it is |
|---|---|---|---|
product | text | yes | The product's name, as declared. |
email | text | no | For a guest who is not signed in. |
quantity | integer | no | How many, 1 by default. |
reference | text | no | Anything the payment event should carry back, such as a booking's id. |
return_path | text | no | The page of your site the person comes back to. |
expires_in | integer | no | Minutes until the page stops taking payment. |
What it answers, for example
{
"checkout": "chk_5Tq",
"expires_at": "2026-10-02T09:30:00Z",
"url": "https://checkout.stripe.com/c/pay/cs_test_a1"
}DoOpen the billing pageAnswers the address of Stripe's page where the signed-in person changes a card, reads invoices and switches plan.
It takes nothing.
What it answers, for example
{
"url": "https://billing.stripe.com/p/session/test_b2"
}DoRefund a paymentAsks Stripe to refund, after the action commits, so an action that refuses refunds nothing.
| Parameter | Type | Needed | What it is |
|---|---|---|---|
payment | text | yes | The payment to refund, from its payment event. |
amount | integer | no | Cents to refund. Left out, the whole of what is left. |
reason | text | no | Why, for your own records. |
What it answers, for example
{
"status": "requested"
}DoCancel a subscriptionAsks Stripe to end a subscription, now, at the end of the paid period, or on a date.
| Parameter | Type | Needed | What it is |
|---|---|---|---|
subscription | text | yes | The subscription, from its event. |
when | text | yes | now, period_end, or a date. |
What it answers, for example
{
"status": "requested"
}Reads
What an action of your backend reads from Stripe.
ReadRead subscriptionsThe subscriptions of the signed-in person, newest first, or of any person for a staff role.
| Parameter | Type | Needed | What it is |
|---|---|---|---|
person | text | no | Whose subscriptions, for a staff role. Left out, the signed-in person's own. |
What it answers, for example
[
{
"product": "Monthly",
"status": "active"
}
]What it cannot do yet
- Stripe is the one payment provider today. Paddle, Lemon Squeezy and Mollie are not built.
- It does not send Stripe invoices.
Add Stripe to your backend
It declares your products, names the action for each event, and sends you a link where you paste your Stripe key. Changes on Live wait for a person to approve them.
Add Stripe payments to my backend on Typestate.Open an accountBlueprints that use it
More payments and related integrations
Resend
Send email from your own address: sign-in links, receipts, reminders.
Amazon SES
Send email through your own Amazon Web Services account, at volume.
SendGrid
Send email through your own SendGrid account.
Made by Typestate, and not by Stripe. Stripe does not endorse Typestate. Stripe's own site