Typestate
Sign in
Stripe logo

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 your agent does with this integration

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 getsTypeWhat it is
eventtextWhich event it is, such as payment.succeeded.
idtextThe same for every run of one event, so an action can tell a repeat.
persontextThe account of the person who paid, when they were signed in.
producttextThe product's name, as it was declared.
referencetextWhat the action that opened the payment page gave as its reference, such as a booking's id.
paymenttextThe payment, for a refund.
subscriptiontextThe subscription, for a subscription event.
refundtextThe refund, for a refund event.
statustextThe state after the event.
amountintegerHow much, in the smallest unit of the currency (cents).
currencytextThree 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 getsTypeWhat it is
eventtextWhich event it is, such as payment.succeeded.
idtextThe same for every run of one event, so an action can tell a repeat.
persontextThe account of the person who paid, when they were signed in.
producttextThe product's name, as it was declared.
referencetextWhat the action that opened the payment page gave as its reference, such as a booking's id.
paymenttextThe payment, for a refund.
subscriptiontextThe subscription, for a subscription event.
refundtextThe refund, for a refund event.
statustextThe state after the event.
amountintegerHow much, in the smallest unit of the currency (cents).
currencytextThree 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 getsTypeWhat it is
eventtextWhich event it is, such as payment.succeeded.
idtextThe same for every run of one event, so an action can tell a repeat.
persontextThe account of the person who paid, when they were signed in.
producttextThe product's name, as it was declared.
referencetextWhat the action that opened the payment page gave as its reference, such as a booking's id.
paymenttextThe payment, for a refund.
subscriptiontextThe subscription, for a subscription event.
refundtextThe refund, for a refund event.
statustextThe state after the event.
amountintegerHow much, in the smallest unit of the currency (cents).
currencytextThree 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 getsTypeWhat it is
eventtextWhich event it is, such as payment.succeeded.
idtextThe same for every run of one event, so an action can tell a repeat.
persontextThe account of the person who paid, when they were signed in.
producttextThe product's name, as it was declared.
referencetextWhat the action that opened the payment page gave as its reference, such as a booking's id.
paymenttextThe payment, for a refund.
subscriptiontextThe subscription, for a subscription event.
refundtextThe refund, for a refund event.
statustextThe state after the event.
amountintegerHow much, in the smallest unit of the currency (cents).
currencytextThree 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 getsTypeWhat it is
eventtextWhich event it is, such as payment.succeeded.
idtextThe same for every run of one event, so an action can tell a repeat.
persontextThe account of the person who paid, when they were signed in.
producttextThe product's name, as it was declared.
referencetextWhat the action that opened the payment page gave as its reference, such as a booking's id.
paymenttextThe payment, for a refund.
subscriptiontextThe subscription, for a subscription event.
refundtextThe refund, for a refund event.
statustextThe state after the event.
amountintegerHow much, in the smallest unit of the currency (cents).
currencytextThree 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 getsTypeWhat it is
eventtextWhich event it is, such as payment.succeeded.
idtextThe same for every run of one event, so an action can tell a repeat.
persontextThe account of the person who paid, when they were signed in.
producttextThe product's name, as it was declared.
referencetextWhat the action that opened the payment page gave as its reference, such as a booking's id.
paymenttextThe payment, for a refund.
subscriptiontextThe subscription, for a subscription event.
refundtextThe refund, for a refund event.
statustextThe state after the event.
amountintegerHow much, in the smallest unit of the currency (cents).
currencytextThree 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 getsTypeWhat it is
eventtextWhich event it is, such as payment.succeeded.
idtextThe same for every run of one event, so an action can tell a repeat.
persontextThe account of the person who paid, when they were signed in.
producttextThe product's name, as it was declared.
referencetextWhat the action that opened the payment page gave as its reference, such as a booking's id.
paymenttextThe payment, for a refund.
subscriptiontextThe subscription, for a subscription event.
refundtextThe refund, for a refund event.
statustextThe state after the event.
amountintegerHow much, in the smallest unit of the currency (cents).
currencytextThree 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 getsTypeWhat it is
eventtextWhich event it is, such as payment.succeeded.
idtextThe same for every run of one event, so an action can tell a repeat.
persontextThe account of the person who paid, when they were signed in.
producttextThe product's name, as it was declared.
referencetextWhat the action that opened the payment page gave as its reference, such as a booking's id.
paymenttextThe payment, for a refund.
subscriptiontextThe subscription, for a subscription event.
refundtextThe refund, for a refund event.
statustextThe state after the event.
amountintegerHow much, in the smallest unit of the currency (cents).
currencytextThree 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.
ParameterTypeNeededWhat it is
producttextyesThe product's name, as declared.
emailtextnoFor a guest who is not signed in.
quantityintegernoHow many, 1 by default.
referencetextnoAnything the payment event should carry back, such as a booking's id.
return_pathtextnoThe page of your site the person comes back to.
expires_inintegernoMinutes 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.
ParameterTypeNeededWhat it is
paymenttextyesThe payment to refund, from its payment event.
amountintegernoCents to refund. Left out, the whole of what is left.
reasontextnoWhy, 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.
ParameterTypeNeededWhat it is
subscriptiontextyesThe subscription, from its event.
whentextyesnow, 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.
ParameterTypeNeededWhat it is
persontextnoWhose 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 account

Blueprints that use it

More payments and related integrations

Made by Typestate, and not by Stripe. Stripe does not endorse Typestate. Stripe's own site