> For the complete documentation index, see [llms.txt](https://docs.ondiagram.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ondiagram.com/nodes/stripe.md).

# Stripe

## General

The \`Stripe\` node allows to perform various stripe operations like creating a new subscription for a customer, update their billing info and upgrade their account to a different plan. It also supports the checkout session and the billing portals.

{% hint style="info" %}
TO handle stripe events with signature verification the `Request` node must receive HTTP request in raw form ie. "Raw Body" must be set to true.
{% endhint %}

## Input

CASE: Customers / Create

* **Customer options:** *(optional)* Receives an `Object` with the customer options. Learn more on [stripe.customer.create](https://stripe.com/docs/api/customers/create).

CASE: Customers / Retrieve

* **Customer id:** Receives a `String` with the customer id to retrieve. Learn more on [stripe.customer.retrieve](https://stripe.com/docs/api/customers/retrieve).

CASE: Payment Methods / Attach

* **Payment method id:** Receives a `String` with the payment method id to attach. Learn more on [stripe.payment\_methods.attach](https://stripe.com/docs/api/payment_methods/attach).
* **Payment method options:** *(optional)* Receives an `Object` with the payment method options. Learn more on [stripe.payment\_methods.attach](https://stripe.com/docs/api/payment_methods/attach).

CASE: Payment Methods / Detach

* **Payment method id:** Receives an `Object` with the payment method id to detach. Learn more on [stripe.payment\_methods.detach](https://stripe.com/docs/api/payment_methods/detach).

CASE: Payment Methods / List

* **Payment method options:** *(optional)* Receives an `Object` with the payment method options. Learn more on [stripe.payment\_methods.list](https://stripe.com/docs/api/payment_methods/list).

CASE: Payment Methods / Retrieve

* **Payment method id:** Receives a `String` with the payment method id to retrieve. Learn more on [stripe.payment\_methods.retrieve](https://stripe.com/docs/api/payment_methods/retrieve).

CASE: Plans / List

* **Plans options:** *(optional)* Receives an `Object` with the plans options. Learn more on [stripe.plans.list](https://stripe.com/docs/api/plans/list).

CASE: Subscriptions / Create

* **Subscription options:** Receives an `Object` with the subscription options. The \`String\` customer\_id and the `Object` items with the subscription data are required. Learn more on [stripe.subscriptions.create](https://stripe.com/docs/api/subscriptions/create).

CASE: Subscriptions / Update

* **Subscription id:** Receives a `String` with the subscription id to update. Learn more on [stripe.subscriptions.update](https://stripe.com/docs/api/subscriptions/update).
* **Subscription options:** Receives an `Object` with the subscription options. Learn more on [stripe.subscriptions.update](https://stripe.com/docs/api/subscriptions/update).

CASE: Billing Portal Sessions / Create

* **Session options:** Receives an `Object` with the session options. Learn more on [stripe.customer\_portal.create](https://stripe.com/docs/api/customer_portal/create).

CASE: Checkout Sessions / Create

* **Session options:** Receives an `Object` with the session options. Learn more on [stripe.sessions.create](https://stripe.com/docs/api/checkout/sessions/create).

CASE: Webhooks / Construct Event

* **Request body:** Receives a `String` with request body as a raw string. Requires switching on \`Raw Body\` in the `Request` node. Learn more on [stripe.webhooks.constructEvent](https://stripe.com/docs/webhooks/signatures).
* **Header signature:** Receives a `String` with the \`signature\` header from the \`Request node\`. Learn more on [stripe.webhooks.constructEvent](https://stripe.com/docs/webhooks/signatures).
* **Endpoint secret:** Receives a `String` with the endpoint secret from Stripe Dashboard. Learn more on [stripe.webhooks.constructEvent](https://stripe.com/docs/webhooks/signatures).

Environment variables:

* **stripe:** Requires *Secret Key* to be set.

## Output

CASE: Customers / Create

* **Out:** Returns an `Object` with the created customer data. Learn more on [stripe.customer.create](https://stripe.com/docs/api/customers/create).

CASE: Customers / Retrieve

* **Out:** Returns an `Object` with the customer data. When requesting the ID of a customer that has been deleted, a subset of the customer’s information will be returned. Learn more on [stripe.customer.retrieve](https://stripe.com/docs/api/customers/retrieve).

CASE: Payment Methods / Attach

* **Out:** Returns an `Object` with the payment method data. Learn more on [stripe.payment\_methods.attach](https://stripe.com/docs/api/payment_methods/attach).

CASE: Payment Methods / Detach

* **Out:** Returns an `Object` with the payment method data. Learn more on [stripe.payment\_methods.detach](https://stripe.com/docs/api/payment_methods/detach).

CASE: Payment Methods / List

* **Out:** Returns an array of `Object` with the payment method data. Learn more on [stripe.payment\_methods.list](https://stripe.com/docs/api/payment_methods/list).

CASE: Payment Methods / Retrieve

* **Out:** Returns an `Object` with the payment method data. Learn more on [stripe.payment\_methods.retrieve](https://stripe.com/docs/api/payment_methods/retrieve).

CASE: Plans / List

* **Out:** Returns an array of `Object` with the plan data. Learn more on [stripe.plans.list](https://stripe.com/docs/api/plans/list).

CASE: Subscriptions / Create

* **Out:** Returns an `Object` with the session data. This includes the session id that is used to redirect to the session url. Learn more on [stripe.subscriptions.create](https://stripe.com/docs/api/subscriptions/create).

CASE: Subscriptions / Update

* **Out:** Returns an `Object` with the subscription data. If \`payment\_behavior\` is not set to \`error\_if\_incomplete\` the no error is thrown if it fails. Learn more on [stripe.subscriptions.update](https://stripe.com/docs/api/subscriptions/update).

CASE: Billing Portal Sessions / Create

* **Out:** Returns an `Object` with the session data. Learn more on [stripe.customer\_portal.create](https://stripe.com/docs/api/customer_portal/create).

CASE: Checkout Sessions / Create

* **Out:** Returns an `Object` with the session data. Learn more on [stripe.sessions.create](https://stripe.com/docs/api/checkout/sessions/create).

CASE: Webhooks / Construct Event

* **Out:** Returns an `Object` with two elements, a `String` with the event type and an `Object` with the event data. Learn more on [stripe.webhooks.constructEvent](https://stripe.com/docs/webhooks/signatures).

## Use Cases

Creates a checkout session for updating a customer subscription plan.

* Request (Post) ➡ Stripe (Billing portal) ➡ Response (200)

Receives a Stripe event verifies it and updates the database.

* Request (Post) ➡ Stripe (Construct event) ➡ Database (Update) ➡ Response (200)
