@trigger.dev/stripe: Added PaymentIntent and Payout trigger events

This commit is contained in:
Eric Allam
2023-08-28 12:40:02 +01:00
parent 6ad91123f2
commit a10782490f
8 changed files with 1477 additions and 52 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@trigger.dev/stripe": patch
---
Added additional triggers for PaymentIntent and Payout events
@@ -19,7 +19,10 @@ export async function action({ request }: ActionArgs) {
},
body: JSON.stringify({
title: body.type,
content: body,
content: {
...body,
example: { id: body.type, name: body.type, icon: "stripe", payload: body.data.object },
},
readOnly: true,
}),
});
+80 -41
View File
@@ -9,11 +9,11 @@ title: Stripe
<CodeGroup>
```bash npm
npm install @trigger.dev/stripe@latest
npm add @trigger.dev/stripe@latest
```
```bash pnpm
pnpm install @trigger.dev/stripe@latest
pnpm add @trigger.dev/stripe@latest
```
```bash yarn
@@ -83,48 +83,87 @@ client.defineJob({
Available triggers are listed below:
| Function Name | Events | Description | Aggregate Version |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- | ------------------------ |
| `onCharge` | `charge.succeeded`, `charge.failed`, `charge.captured`, `charge.refunded`, `charge.updated` | Triggered on all charge events | ✔️ |
| `onChargeSucceeded` | `charge.succeeded` | Triggered on charge succeeded events | `onCharge` |
| `onChargeFailed` | `charge.failed` | Triggered on charge failed events | `onCharge` |
| `onChargeCaptured` | `charge.captured` | Triggered on charge captured events | `onCharge` |
| `onChargeRefunded` | `charge.refunded` | Triggered on charge refunded events | `onCharge` |
| `onChargeUpdated` | `charge.updated` | Triggered on charge updated events | `onCharge` |
| `onProduct` | `product.created`, `product.updated`, `product.deleted` | Triggered on all product events | ✔️ |
| `onProductCreated` | `product.created` | Triggered on product created events | `onProduct` |
| `onProductUpdated` | `product.updated` | Triggered on product updated events | `onProduct` |
| `onProductDeleted` | `product.deleted` | Triggered on product deleted events | `onProduct` |
| `onPrice` | `price.created`, `price.updated`, `price.deleted` | Triggered on all price events | ✔️ |
| `onPriceCreated` | `price.created` | Triggered on price created events | `onPrice` |
| `onPriceUpdated` | `price.updated` | Triggered on price updated events | `onPrice` |
| `onPriceDeleted` | `price.deleted` | Triggered on price deleted events | `onPrice` |
| `onCheckoutSession` | `checkout.session.completed`, `checkout.session.async_payment_succeeded`, `checkout.session.async_payment_failed`, `checkout.session.expired` | Triggered on all checkout session events | ✔️ |
| `onCheckoutSessionCompleted` | `checkout.session.completed` | Triggered on checkout session completed events | `onCheckoutSession` |
| `onCheckoutSessionExpired` | `checkout.session.expired` | Triggered on checkout session expired events | `onCheckoutSession` |
| `onCustomerSubscription` | `customer.subscription.created`, `customer.subscription.updated`, `customer.subscription.deleted`, `customer.subscription.paused`, `customer.subscription.pending_updated_applied`, `customer.subscription.pending_update_expired`, `customer.subscription.resumed` | Triggered on all customer subscription events | ✔️ |
| `onCustomerSubscriptionCreated` | `customer.subscription.created` | Triggered on customer subscription created events | `onCustomerSubscription` |
| `onCustomerSubscriptionUpdated` | `customer.subscription.updated` | Triggered on customer subscription updated events | `onCustomerSubscription` |
| `onCustomerSubscriptionDeleted` | `customer.subscription.deleted` | Triggered on customer subscription deleted events | `onCustomerSubscription` |
| `onCustomerSubscriptionPaused` | `customer.subscription.paused` | Triggered on customer subscription paused events | `onCustomerSubscription` |
| `onCustomerSubscriptionPending` | `customer.subscription.pending_updated_applied`, `customer.subscription.pending_update_expired` | Triggered on customer subscription pending events | `onCustomerSubscription` |
| `onCustomerSubscriptionResumed` | `customer.subscription.resumed` | Triggered on customer subscription resumed events | `onCustomerSubscription` |
| `onCustomer` | `customer.created`, `customer.updated`, `customer.deleted` | Triggered on all customer events | ✔️ |
| `onCustomerCreated` | `customer.created` | Triggered on customer created events | `onCustomer` |
| `onCustomerUpdated` | `customer.updated` | Triggered on customer updated events | `onCustomer` |
| `onCustomerDeleted` | `customer.deleted` | Triggered on customer deleted events | `onCustomer` |
| `onExternalAccount` | `account.external_account.created`, `account.external_account.updated`, `account.external_account.deleted` | Triggered on all external account events | ✔️ |
| `onExternalAccountCreated` | `account.external_account.created` | Triggered on external account created events | `onExternalAccount` |
| `onExternalAccountUpdated` | `account.external_account.updated` | Triggered on external account updated events | `onExternalAccount` |
| `onExternalAccountDeleted` | `account.external_account.deleted` | Triggered on external account deleted events | `onExternalAccount` |
| `onPerson` | `account.person.created`, `account.person.updated`, `account.person.deleted` | Triggered on all person events | ✔️ |
| `onPersonCreated` | `account.person.created` | Triggered on person created events | `onPerson` |
| `onPersonUpdated` | `account.person.updated` | Triggered on person updated events | `onPerson` |
| `onPersonDeleted` | `account.person.deleted` | Triggered on person deleted events | `onPerson` |
| `onAccountUpdated` | `account.updated` | Triggered on account updated events | N/A |
| Function Name | Payload Object | Events | Aggregate Version |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
| `onCharge` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.succeeded`, `charge.failed`, `charge.captured`, `charge.refunded`, `charge.updated` | ✔️ |
| `onChargeSucceeded` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.succeeded` | `onCharge` |
| `onChargeFailed` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.failed` | `onCharge` |
| `onChargeCaptured` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.captured` | `onCharge` |
| `onChargeRefunded` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.refunded` | `onCharge` |
| `onChargeUpdated` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.updated` | `onCharge` |
| `onProduct` | [Product](https://stripe.com/docs/api/events/types#product_object) | `product.created`, `product.updated`, `product.deleted` | ✔️ |
| `onProductCreated` | [Product](https://stripe.com/docs/api/events/types#product_object) | `product.created` | `onProduct` |
| `onProductUpdated` | [Product](https://stripe.com/docs/api/events/types#product_object) | `product.updated` | `onProduct` |
| `onProductDeleted` | [Product](https://stripe.com/docs/api/events/types#product_object) | `product.deleted` | `onProduct` |
| `onPrice` | [Price](https://stripe.com/docs/api/events/types#price_object) | `price.created`, `price.updated`, `price.deleted` | ✔️ |
| `onPriceCreated` | [Price](https://stripe.com/docs/api/events/types#price_object) | `price.created` | `onPrice` |
| `onPriceUpdated` | [Price](https://stripe.com/docs/api/events/types#price_object) | `price.updated` | `onPrice` |
| `onPriceDeleted` | [Price](https://stripe.com/docs/api/events/types#price_object) | `price.deleted` | `onPrice` |
| `onCheckoutSession` | [CheckoutSession](https://stripe.com/docs/api/events/types#checkout_session_object) | `checkout.session.completed`, `checkout.session.async_payment_succeeded`, `checkout.session.async_payment_failed`, `checkout.session.expired` | ✔️ |
| `onCheckoutSessionCompleted` | [CheckoutSession](https://stripe.com/docs/api/events/types#checkout_session_object) | `checkout.session.completed` | `onCheckoutSession` |
| `onCheckoutSessionExpired` | [CheckoutSession](https://stripe.com/docs/api/events/types#checkout_session_object) | `checkout.session.expired` | `onCheckoutSession` |
| `onCustomerSubscription` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.created`, `customer.subscription.updated`, `customer.subscription.deleted`, `customer.subscription.paused`, `customer.subscription.pending_updated_applied`, `customer.subscription.pending_update_expired`, `customer.subscription.resumed` | ✔️ |
| `onCustomerSubscriptionCreated` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.created` | `onCustomerSubscription` |
| `onCustomerSubscriptionUpdated` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.updated` | `onCustomerSubscription` |
| `onCustomerSubscriptionDeleted` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.deleted` | `onCustomerSubscription` |
| `onCustomerSubscriptionPaused` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.paused` | `onCustomerSubscription` |
| `onCustomerSubscriptionPending` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.pending_updated_applied`, `customer.subscription.pending_update_expired` | `onCustomerSubscription` |
| `onCustomerSubscriptionResumed` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.resumed` | `onCustomerSubscription` |
| `onCustomer` | [Customer](https://stripe.com/docs/api/events/types#customer_object) | `customer.created`, `customer.updated`, `customer.deleted` | ✔️ |
| `onCustomerCreated` | [Customer](https://stripe.com/docs/api/events/types#customer_object) | `customer.created` | `onCustomer` |
| `onCustomerUpdated` | [Customer](https://stripe.com/docs/api/events/types#customer_object) | `customer.updated` | `onCustomer` |
| `onCustomerDeleted` | [Customer](https://stripe.com/docs/api/events/types#customer_object) | `customer.deleted` | `onCustomer` |
| `onExternalAccount` | [Card](https://stripe.com/docs/api/events/types#account_card_object) or [Bank Account](https://stripe.com/docs/api/events/types#account_bank_account_object) | `account.external_account.created`, `account.external_account.updated`, `account.external_account.deleted` | ✔️ |
| `onExternalAccountCreated` | [Card](https://stripe.com/docs/api/events/types#account_card_object) or [Bank Account](https://stripe.com/docs/api/events/types#account_bank_account_object) | `account.external_account.created` | `onExternalAccount` |
| `onExternalAccountUpdated` | [Card](https://stripe.com/docs/api/events/types#account_card_object) or [Bank Account](https://stripe.com/docs/api/events/types#account_bank_account_object) | `account.external_account.updated` | `onExternalAccount` |
| `onExternalAccountDeleted` | [Card](https://stripe.com/docs/api/events/types#account_card_object) or [Bank Account](https://stripe.com/docs/api/events/types#account_bank_account_object) | `account.external_account.deleted` | `onExternalAccount` |
| `onPerson` | [Person](https://stripe.com/docs/api/events/types#person_object) | `account.person.created`, `account.person.updated`, `account.person.deleted` | ✔️ |
| `onPersonCreated` | [Person](https://stripe.com/docs/api/events/types#person_object) | `account.person.created` | `onPerson` |
| `onPersonUpdated` | [Person](https://stripe.com/docs/api/events/types#person_object) | `account.person.updated` | `onPerson` |
| `onPersonDeleted` | [Person](https://stripe.com/docs/api/events/types#person_object) | `account.person.deleted` | `onPerson` |
| `onAccountUpdated` | [Account](https://stripe.com/docs/api/events/types#account_object) | `account.updated` | N/A |
| `onPaymentIntent` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.created`, `payment_intent.succeeded`, `payment_intent.payment_failed`, `payment_intent.canceled`, `payment_intent.processing`, `payment_intent.amount_capturable_updated`, `payment_intent.requires_action`, `payment_intent.partially_funded` | ✔️ |
| `onPaymentIntentCreated` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.created` | `onPaymentIntent` |
| `onPaymentIntentSucceeded` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.succeeded` | `onPaymentIntent` |
| `onPaymentIntentPaymentFailed` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.payment_failed` | `onPaymentIntent` |
| `onPaymentIntentCanceled` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.canceled` | `onPaymentIntent` |
| `onPaymentIntentProcessing` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.processing` | `onPaymentIntent` |
| `onPaymentIntentRequiresAction` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.requires_action` | `onPaymentIntent` |
| `onPaymentIntentAmountCapturableUpdated` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.amount_capturable_updated` | `onPaymentIntent` |
| `onPaymentIntentPartiallyFunded` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.partially_funded` | `onPaymentIntent` |
| `onPayout` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.created`, `payout.updated`, `payout.canceled`, `payout.paid`, `payout.failed`, `payout.reconciliation_completed` | ✔️ |
| `onPayoutCreated` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.created` | `onPayout` |
| `onPayoutUpdated` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.updated` | `onPayout` |
| `onPayoutCanceled` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.canceled` | `onPayout` |
| `onPayoutPaid` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.paid` | `onPayout` |
| `onPayoutFailed` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.failed` | `onPayout` |
| `onPayoutReconciliationCompleted` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.reconciliation_completed` | `onPayout` |
If there are any triggers missing that you'd like to see added, please [open a new GitHub Issue](https://github.com/triggerdotdev/trigger.dev/issues/new)
### Filtering
All the Stripe triggers take an optional `filter` parameter that allows you to only run the job when the filter matches the event payload:
```ts
// Only trigger when the currency is USD
client.defineJob({
id: "stripe-on-subscription-created",
name: "Stripe On Subscription Created",
version: "0.1.0",
trigger: stripe.onCustomerSubscriptionCreated({
filter: {
currency: ["usd"],
},
}),
run: async (payload, io, ctx) => {
await io.logger.info("ctx", { ctx });
},
});
```
Check out our [Event Filter docs](/documentation/guides/event-filter) for more information on how to use the filter.
## Tasks
You can make reliable calls to the Stripe API inside of jobs using the exposed stripe tasks:
+10
View File
@@ -186,4 +186,14 @@ client.defineJob({
},
});
client.defineJob({
id: "stripe-on-charge",
name: "Stripe On Charge",
version: "0.1.0",
trigger: stripe.onCharge(),
run: async (payload, io, ctx) => {
await io.logger.info("ctx", { ctx });
},
});
createExpressServer(client);
+232 -10
View File
@@ -1,9 +1,21 @@
import type { EventSpecification } from "@trigger.dev/sdk";
import {
amountCapturablePaymentIntentExample,
cancelledPaymentIntentExample,
cancelledSubscriptionExample,
capturedChargeExample,
checkoutSessionExample,
createdCustomerExample,
createdPaymentIntentExample,
customerSubscriptionExample,
deletedCustomerExample,
failedChargeExample,
failedPaymentIntentExample,
pausedSubscriptionExample,
refundedChargeExample,
succeededChargeExample,
succeededPaymentIntentExample,
updatedAccountExample,
updatedSubscriptionExample,
} from "./examples";
import {
@@ -13,6 +25,8 @@ import {
OnCustomerEvent,
OnCustomerSubscription,
OnExternalAccountEvent,
OnPaymentIntentEvent,
OnPayoutEvent,
OnPersonEvent,
OnPriceEvent,
OnProductEvent,
@@ -467,7 +481,7 @@ export const onAccountUpdated: EventSpecification<OnAccountEvent> = {
title: "On Account Updated",
source: "stripe.com",
icon: "stripe",
examples: [],
examples: [updatedAccountExample],
parsePayload: (payload) => payload as OnAccountEvent,
runProperties: (payload) => [
{ label: "Account ID", text: payload.id },
@@ -480,7 +494,7 @@ export const onCustomer: EventSpecification<OnCustomerEvent> = {
title: "On Customer Event",
source: "stripe.com",
icon: "stripe",
examples: [],
examples: [createdCustomerExample],
parsePayload: (payload) => payload as OnCustomerEvent,
runProperties: (payload) => [{ label: "Customer ID", text: payload.id }],
};
@@ -490,7 +504,7 @@ export const onCustomerCreated: EventSpecification<OnCustomerEvent> = {
title: "On Customer Created",
source: "stripe.com",
icon: "stripe",
examples: [],
examples: [createdCustomerExample],
parsePayload: (payload) => payload as OnCustomerEvent,
runProperties: (payload) => [{ label: "Customer ID", text: payload.id }],
};
@@ -500,7 +514,7 @@ export const onCustomerDeleted: EventSpecification<OnCustomerEvent> = {
title: "On Customer Deleted",
source: "stripe.com",
icon: "stripe",
examples: [],
examples: [deletedCustomerExample],
parsePayload: (payload) => payload as OnCustomerEvent,
runProperties: (payload) => [{ label: "Customer ID", text: payload.id }],
};
@@ -510,7 +524,7 @@ export const onCustomerUpdated: EventSpecification<OnCustomerEvent> = {
title: "On Customer Updated",
source: "stripe.com",
icon: "stripe",
examples: [],
examples: [createdCustomerExample],
parsePayload: (payload) => payload as OnCustomerEvent,
runProperties: (payload) => [{ label: "Customer ID", text: payload.id }],
};
@@ -528,7 +542,12 @@ export const onCharge: EventSpecification<OnChargeEvent> = {
title: "On Charge Event",
source: "stripe.com",
icon: "stripe",
examples: [],
examples: [
capturedChargeExample,
succeededChargeExample,
failedChargeExample,
refundedChargeExample,
],
parsePayload: (payload) => payload as OnChargeEvent,
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
};
@@ -538,7 +557,7 @@ export const onChargeCaptured: EventSpecification<OnChargeEvent> = {
title: "On Charge Captured",
source: "stripe.com",
icon: "stripe",
examples: [],
examples: [capturedChargeExample],
parsePayload: (payload) => payload as OnChargeEvent,
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
};
@@ -558,7 +577,7 @@ export const onChargeFailed: EventSpecification<OnChargeEvent> = {
title: "On Charge Failed",
source: "stripe.com",
icon: "stripe",
examples: [],
examples: [failedChargeExample],
parsePayload: (payload) => payload as OnChargeEvent,
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
};
@@ -578,7 +597,7 @@ export const onChargeRefunded: EventSpecification<OnChargeEvent> = {
title: "On Charge Refunded",
source: "stripe.com",
icon: "stripe",
examples: [],
examples: [refundedChargeExample],
parsePayload: (payload) => payload as OnChargeEvent,
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
};
@@ -588,7 +607,7 @@ export const onChargeSucceeded: EventSpecification<OnChargeEvent> = {
title: "On Charge Succeeded",
source: "stripe.com",
icon: "stripe",
examples: [],
examples: [succeededChargeExample],
parsePayload: (payload) => payload as OnChargeEvent,
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
};
@@ -710,3 +729,206 @@ export const onPersonUpdated: EventSpecification<OnPersonEvent> = {
{ label: "Account", text: payload.account },
],
};
export const onPaymentIntent: EventSpecification<OnPaymentIntentEvent> = {
name: [
"payment_intent.created",
"payment_intent.succeeded",
"payment_intent.canceled",
"payment_intent.processing",
"payment_intent.requires_action",
"payment_intent.amount_capturable_updated",
"payment_intent.payment_failed",
"payment_intent.partially_funded",
],
title: "On Payment Intent Event",
source: "stripe.com",
icon: "stripe",
examples: [
createdPaymentIntentExample,
succeededPaymentIntentExample,
cancelledPaymentIntentExample,
amountCapturablePaymentIntentExample,
failedPaymentIntentExample,
],
parsePayload: (payload) => payload as OnPaymentIntentEvent,
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
};
export const onPaymentIntentCreated: EventSpecification<OnPaymentIntentEvent> = {
name: "payment_intent.created",
title: "On Payment Intent Created",
source: "stripe.com",
icon: "stripe",
examples: [createdPaymentIntentExample],
parsePayload: (payload) => payload as OnPaymentIntentEvent,
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
};
export const onPaymentIntentSucceeded: EventSpecification<OnPaymentIntentEvent> = {
name: "payment_intent.succeeded",
title: "On Payment Intent Succeeded",
source: "stripe.com",
icon: "stripe",
examples: [succeededPaymentIntentExample],
parsePayload: (payload) => payload as OnPaymentIntentEvent,
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
};
export const onPaymentIntentCanceled: EventSpecification<OnPaymentIntentEvent> = {
name: "payment_intent.canceled",
title: "On Payment Intent Canceled",
source: "stripe.com",
icon: "stripe",
examples: [cancelledPaymentIntentExample],
parsePayload: (payload) => payload as OnPaymentIntentEvent,
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
};
export const onPaymentIntentProcessing: EventSpecification<OnPaymentIntentEvent> = {
name: "payment_intent.processing",
title: "On Payment Intent Processing",
source: "stripe.com",
icon: "stripe",
examples: [],
parsePayload: (payload) => payload as OnPaymentIntentEvent,
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
};
export const onPaymentIntentRequiresAction: EventSpecification<OnPaymentIntentEvent> = {
name: "payment_intent.requires_action",
title: "On Payment Intent Requires Action",
source: "stripe.com",
icon: "stripe",
examples: [],
parsePayload: (payload) => payload as OnPaymentIntentEvent,
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
};
export const onPaymentIntentAmountCapturableUpdated: EventSpecification<OnPaymentIntentEvent> = {
name: "payment_intent.amount_capturable_updated",
title: "On Payment Intent Amount Capturable Updated",
source: "stripe.com",
icon: "stripe",
examples: [amountCapturablePaymentIntentExample],
parsePayload: (payload) => payload as OnPaymentIntentEvent,
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
};
export const onPaymentIntentPaymentFailed: EventSpecification<OnPaymentIntentEvent> = {
name: "payment_intent.payment_failed",
title: "On Payment Intent Payment Failed",
source: "stripe.com",
icon: "stripe",
examples: [failedPaymentIntentExample],
parsePayload: (payload) => payload as OnPaymentIntentEvent,
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
};
export const onPaymentIntentPartiallyFunded: EventSpecification<OnPaymentIntentEvent> = {
name: "payment_intent.partially_funded",
title: "On Payment Intent Partially Funded",
source: "stripe.com",
icon: "stripe",
examples: [],
parsePayload: (payload) => payload as OnPaymentIntentEvent,
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
};
export const onPayout: EventSpecification<OnPayoutEvent> = {
name: [
"payout.canceled",
"payout.created",
"payout.failed",
"payout.paid",
"payout.reconciliation_completed",
"payout.updated",
],
title: "On Payout Event",
source: "stripe.com",
icon: "stripe",
examples: [],
parsePayload: (payload) => payload as OnPayoutEvent,
runProperties: (payload) => [
{ label: "Payout ID", text: payload.id },
{ label: "Amount", text: `${payload.amount} ${payload.currency}` },
],
};
export const onPayoutCancelled: EventSpecification<OnPayoutEvent> = {
name: "payout.canceled",
title: "On Payout Cancelled Event",
source: "stripe.com",
icon: "stripe",
examples: [],
parsePayload: (payload) => payload as OnPayoutEvent,
runProperties: (payload) => [
{ label: "Payout ID", text: payload.id },
{ label: "Amount", text: `${payload.amount} ${payload.currency}` },
],
};
export const onPayoutCreated: EventSpecification<OnPayoutEvent> = {
name: "payout.created",
title: "On Payout Created Event",
source: "stripe.com",
icon: "stripe",
examples: [],
parsePayload: (payload) => payload as OnPayoutEvent,
runProperties: (payload) => [
{ label: "Payout ID", text: payload.id },
{ label: "Amount", text: `${payload.amount} ${payload.currency}` },
],
};
export const onPayoutFailed: EventSpecification<OnPayoutEvent> = {
name: "payout.failed",
title: "On Payout Failed Event",
source: "stripe.com",
icon: "stripe",
examples: [],
parsePayload: (payload) => payload as OnPayoutEvent,
runProperties: (payload) => [
{ label: "Payout ID", text: payload.id },
{ label: "Amount", text: `${payload.amount} ${payload.currency}` },
],
};
export const onPayoutPaid: EventSpecification<OnPayoutEvent> = {
name: "payout.paid",
title: "On Payout Paid Event",
source: "stripe.com",
icon: "stripe",
examples: [],
parsePayload: (payload) => payload as OnPayoutEvent,
runProperties: (payload) => [
{ label: "Payout ID", text: payload.id },
{ label: "Amount", text: `${payload.amount} ${payload.currency}` },
],
};
export const onPayoutReconciliationCompleted: EventSpecification<OnPayoutEvent> = {
name: "payout.reconciliation_completed",
title: "On Payout Reconciliation Completed Event",
source: "stripe.com",
icon: "stripe",
examples: [],
parsePayload: (payload) => payload as OnPayoutEvent,
runProperties: (payload) => [
{ label: "Payout ID", text: payload.id },
{ label: "Amount", text: `${payload.amount} ${payload.currency}` },
],
};
export const onPayoutUpdated: EventSpecification<OnPayoutEvent> = {
name: "payout.updated",
title: "On Payout Updated Event",
source: "stripe.com",
icon: "stripe",
examples: [],
parsePayload: (payload) => payload as OnPayoutEvent,
runProperties: (payload) => [
{ label: "Payout ID", text: payload.id },
{ label: "Amount", text: `${payload.amount} ${payload.currency}` },
],
};
+929
View File
@@ -698,3 +698,932 @@ export const updatedSubscriptionExample = {
trial_start: null,
},
};
export const updatedAccountExample = {
id: "test_account",
name: "Updated Account",
icon: "stripe",
payload: {
id: "acct_1Nk2DXINGsstqbEy",
object: "account",
business_profile: {
mcc: null,
name: null,
support_address: null,
support_email: null,
support_phone: null,
support_url: null,
url: null,
product_description: null,
},
capabilities: {},
charges_enabled: false,
controller: {
type: "application",
is_controller: true,
},
country: "GB",
default_currency: "gbp",
details_submitted: false,
email: null,
payouts_enabled: false,
settings: {
bacs_debit_payments: {},
branding: {
icon: null,
logo: null,
primary_color: null,
secondary_color: null,
},
card_issuing: {
tos_acceptance: {
date: null,
ip: null,
},
},
card_payments: {
statement_descriptor_prefix: null,
statement_descriptor_prefix_kanji: null,
statement_descriptor_prefix_kana: null,
decline_on: {
avs_failure: false,
cvc_failure: false,
},
},
dashboard: {
display_name: null,
timezone: "Etc/UTC",
},
payments: {
statement_descriptor: null,
statement_descriptor_kana: null,
statement_descriptor_kanji: null,
},
sepa_debit_payments: {},
payouts: {
debit_negative_balances: true,
schedule: {
delay_days: 7,
interval: "daily",
},
statement_descriptor: null,
},
},
type: "standard",
business_type: null,
created: 1693216724,
external_accounts: {
object: "list",
data: [],
has_more: false,
total_count: 0,
url: "/v1/accounts/acct_1Nk2DXINGsstqbEy/external_accounts",
},
future_requirements: {
alternatives: [],
current_deadline: null,
currently_due: [],
disabled_reason: null,
errors: [],
eventually_due: [],
past_due: [],
pending_verification: [],
},
metadata: {
foo: "bar",
},
requirements: {
alternatives: [],
current_deadline: null,
currently_due: [
"business_profile.product_description",
"business_profile.support_phone",
"business_profile.url",
"external_account",
"tos_acceptance.date",
"tos_acceptance.ip",
],
disabled_reason: "requirements.past_due",
errors: [],
eventually_due: [
"business_profile.product_description",
"business_profile.support_phone",
"business_profile.url",
"external_account",
"tos_acceptance.date",
"tos_acceptance.ip",
],
past_due: ["external_account", "tos_acceptance.date", "tos_acceptance.ip"],
pending_verification: [],
},
tos_acceptance: {
date: null,
ip: null,
user_agent: null,
},
},
};
export const createdCustomerExample = {
id: "created_customer",
name: "Created Customer",
icon: "stripe",
payload: {
id: "cus_OX6SuD19Ej1AwM",
object: "customer",
address: null,
balance: 0,
created: 1693216865,
currency: null,
default_source: null,
delinquent: false,
description: "(created by Stripe CLI)",
discount: null,
email: null,
invoice_prefix: "02F47541",
invoice_settings: {
custom_fields: null,
default_payment_method: null,
footer: null,
rendering_options: null,
},
livemode: false,
metadata: {},
name: null,
phone: null,
preferred_locales: [],
shipping: null,
tax_exempt: "none",
test_clock: null,
},
};
export const deletedCustomerExample = {
id: "deleted_customer",
name: "Deleted Customer",
icon: "stripe",
payload: {
id: "cus_OX6UWArTxl2eGx",
object: "customer",
address: null,
balance: 0,
created: 1693216947,
currency: null,
default_source: null,
delinquent: false,
description: "(created by Stripe CLI)",
discount: null,
email: null,
invoice_prefix: "2761E4C9",
invoice_settings: {
custom_fields: null,
default_payment_method: null,
footer: null,
rendering_options: null,
},
livemode: false,
metadata: {},
name: null,
phone: null,
preferred_locales: [],
shipping: null,
tax_exempt: "none",
test_clock: null,
},
};
export const capturedChargeExample = {
id: "charge.captured",
name: "charge.captured",
icon: "stripe",
payload: {
id: "ch_3Nk2IZI0XSgju2ur1KjXKcEP",
object: "charge",
amount: 2000,
amount_captured: 2000,
amount_refunded: 0,
application: null,
application_fee: null,
application_fee_amount: null,
balance_transaction: "txn_3Nk2IZI0XSgju2ur1yBd2FPs",
billing_details: {
address: {
city: null,
country: null,
line1: null,
line2: null,
postal_code: null,
state: null,
},
email: null,
name: null,
phone: null,
},
calculated_statement_descriptor: "WWW.TRIGGER.DEV",
captured: true,
created: 1693217035,
currency: "usd",
customer: null,
description: "(created by Stripe CLI)",
destination: null,
dispute: null,
disputed: false,
failure_balance_transaction: null,
failure_code: null,
failure_message: null,
fraud_details: {},
invoice: null,
livemode: false,
metadata: {},
on_behalf_of: null,
order: null,
outcome: {
network_status: "approved_by_network",
reason: null,
risk_level: "normal",
risk_score: 23,
seller_message: "Payment complete.",
type: "authorized",
},
paid: true,
payment_intent: "pi_3Nk2IZI0XSgju2ur1c5PRXzB",
payment_method: "pm_1Nk2IZI0XSgju2urQoHr945x",
payment_method_details: {
card: {
brand: "visa",
checks: {
address_line1_check: null,
address_postal_code_check: null,
cvc_check: null,
},
country: "US",
exp_month: 8,
exp_year: 2024,
fingerprint: "w6qgKDLO5EbIJ5VZ",
funding: "credit",
installments: null,
last4: "4242",
mandate: null,
network: "visa",
network_token: {
used: false,
},
three_d_secure: null,
wallet: null,
},
type: "card",
},
receipt_email: null,
receipt_number: null,
receipt_url:
"https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xTVJtRzRJMFhTZ2p1MnVyKI3isacGMgaiHlW3-3o6LBbtHkEOlE2XK3_d2h9msrs3bTJvZi8DcqHrvcQrwxPHm8rP3LA2i5wTqA7Y",
refunded: false,
review: null,
shipping: null,
source: null,
source_transfer: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: "succeeded",
transfer_data: null,
transfer_group: null,
},
};
export const succeededChargeExample = {
id: "charge.succeeded",
name: "charge.succeeded",
icon: "stripe",
payload: {
id: "ch_3Nk2MlI0XSgju2ur0Zcv519e",
object: "charge",
amount: 2000,
amount_captured: 0,
amount_refunded: 0,
application: null,
application_fee: null,
application_fee_amount: null,
balance_transaction: null,
billing_details: {
address: {
city: null,
country: null,
line1: null,
line2: null,
postal_code: null,
state: null,
},
email: null,
name: null,
phone: null,
},
calculated_statement_descriptor: "WWW.TRIGGER.DEV",
captured: false,
created: 1693217296,
currency: "usd",
customer: null,
description: "(created by Stripe CLI)",
destination: null,
dispute: null,
disputed: false,
failure_balance_transaction: null,
failure_code: null,
failure_message: null,
fraud_details: {},
invoice: null,
livemode: false,
metadata: {},
on_behalf_of: null,
order: null,
outcome: {
network_status: "approved_by_network",
reason: null,
risk_level: "normal",
risk_score: 3,
seller_message: "Payment complete.",
type: "authorized",
},
paid: true,
payment_intent: "pi_3Nk2MlI0XSgju2ur0p8h6qIg",
payment_method: "pm_1Nk2MlI0XSgju2urdy1jOUTb",
payment_method_details: {
card: {
brand: "visa",
checks: {
address_line1_check: null,
address_postal_code_check: null,
cvc_check: null,
},
country: "US",
exp_month: 8,
exp_year: 2024,
fingerprint: "w6qgKDLO5EbIJ5VZ",
funding: "credit",
installments: null,
last4: "4242",
mandate: null,
network: "visa",
network_token: {
used: false,
},
three_d_secure: null,
wallet: null,
},
type: "card",
},
receipt_email: null,
receipt_number: null,
receipt_url:
"https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xTVJtRzRJMFhTZ2p1MnVyKJDksacGMgYAj-PAr_s6LBapIJAZx3QBJGs7up7CDkowPkzJbOD1CzDvmilNbsloUF9ovZ3sWPq6F5SN",
refunded: false,
review: null,
shipping: null,
source: null,
source_transfer: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: "succeeded",
transfer_data: null,
transfer_group: null,
},
};
export const failedChargeExample = {
id: "charge.failed",
name: "charge.failed",
icon: "stripe",
payload: {
id: "ch_3Nk2OVI0XSgju2ur09WGXz58",
object: "charge",
amount: 100,
amount_captured: 0,
amount_refunded: 0,
application: null,
application_fee: null,
application_fee_amount: null,
balance_transaction: null,
billing_details: {
address: {
city: null,
country: null,
line1: null,
line2: null,
postal_code: null,
state: null,
},
email: null,
name: null,
phone: null,
},
calculated_statement_descriptor: "WWW.TRIGGER.DEV",
captured: false,
created: 1693217403,
currency: "usd",
customer: null,
description: "(created by Stripe CLI)",
destination: null,
dispute: null,
disputed: false,
failure_balance_transaction: null,
failure_code: "card_declined",
failure_message: "Your card was declined.",
fraud_details: {},
invoice: null,
livemode: false,
metadata: {},
on_behalf_of: null,
order: null,
outcome: {
network_status: "declined_by_network",
reason: "generic_decline",
risk_level: "normal",
risk_score: 10,
seller_message: "The bank did not return any further details with this decline.",
type: "issuer_declined",
},
paid: false,
payment_intent: "pi_3Nk2OVI0XSgju2ur0HYvM3Zu",
payment_method: "pm_1Nk2OVI0XSgju2uri9io5fc0",
payment_method_details: {
card: {
brand: "visa",
checks: {
address_line1_check: null,
address_postal_code_check: null,
cvc_check: null,
},
country: "US",
exp_month: 8,
exp_year: 2024,
fingerprint: "LvNwBVtV2ETBNH8a",
funding: "credit",
installments: null,
last4: "0002",
mandate: null,
network: "visa",
network_token: {
used: false,
},
three_d_secure: null,
wallet: null,
},
type: "card",
},
receipt_email: null,
receipt_number: null,
receipt_url: null,
refunded: false,
review: null,
shipping: null,
source: null,
source_transfer: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: "failed",
transfer_data: null,
transfer_group: null,
},
};
export const refundedChargeExample = {
id: "charge.refunded",
name: "charge.refunded",
icon: "stripe",
payload: {
id: "ch_3Nk2PLI0XSgju2ur1DqK0bOn",
object: "charge",
amount: 100,
amount_captured: 100,
amount_refunded: 100,
application: null,
application_fee: null,
application_fee_amount: null,
balance_transaction: "txn_3Nk2PLI0XSgju2ur18SfGzBU",
billing_details: {
address: {
city: null,
country: null,
line1: null,
line2: null,
postal_code: null,
state: null,
},
email: null,
name: null,
phone: null,
},
calculated_statement_descriptor: "WWW.TRIGGER.DEV",
captured: true,
created: 1693217456,
currency: "usd",
customer: null,
description: "(created by Stripe CLI)",
destination: null,
dispute: null,
disputed: false,
failure_balance_transaction: null,
failure_code: null,
failure_message: null,
fraud_details: {},
invoice: null,
livemode: false,
metadata: {},
on_behalf_of: null,
order: null,
outcome: {
network_status: "approved_by_network",
reason: null,
risk_level: "normal",
risk_score: 50,
seller_message: "Payment complete.",
type: "authorized",
},
paid: true,
payment_intent: "pi_3Nk2PLI0XSgju2ur1yLml2Ev",
payment_method: "pm_1Nk2PLI0XSgju2urkxIUAHNK",
payment_method_details: {
card: {
brand: "visa",
checks: {
address_line1_check: null,
address_postal_code_check: null,
cvc_check: null,
},
country: "US",
exp_month: 8,
exp_year: 2024,
fingerprint: "w6qgKDLO5EbIJ5VZ",
funding: "credit",
installments: null,
last4: "4242",
mandate: null,
network: "visa",
network_token: {
used: false,
},
three_d_secure: null,
wallet: null,
},
type: "card",
},
receipt_email: null,
receipt_number: null,
receipt_url:
"https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xTVJtRzRJMFhTZ2p1MnVyKLLlsacGMgbTw8sUtqQ6LBZlhILTcNiKqiXYypfyG6CAcLzUmgE7d6GU9FnnRWNQy6-jhF7lW9GCj7qY",
refunded: true,
review: null,
shipping: null,
source: null,
source_transfer: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: "succeeded",
transfer_data: null,
transfer_group: null,
},
};
export const createdPaymentIntentExample = {
id: "payment_intent.created",
name: "payment_intent.created",
icon: "stripe",
payload: {
id: "pi_3Nk2yoI0XSgju2ur14qyhbN6",
object: "payment_intent",
amount: 2000,
amount_capturable: 0,
amount_details: {
tip: {},
},
amount_received: 0,
application: null,
application_fee_amount: null,
automatic_payment_methods: null,
canceled_at: null,
cancellation_reason: null,
capture_method: "automatic",
client_secret: "pi_3Nk2yoI0XSgju2ur14qyhbN6_secret_gBSFGokLjHKfG8f5FeVYggBls",
confirmation_method: "automatic",
created: 1693219654,
currency: "usd",
customer: null,
description: "(created by Stripe CLI)",
invoice: null,
last_payment_error: null,
latest_charge: null,
livemode: false,
metadata: {},
next_action: null,
on_behalf_of: null,
payment_method: null,
payment_method_options: {
card: {
installments: null,
mandate_options: null,
network: null,
request_three_d_secure: "automatic",
},
},
payment_method_types: ["card"],
processing: null,
receipt_email: null,
review: null,
setup_future_usage: null,
shipping: null,
source: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: "requires_payment_method",
transfer_data: null,
transfer_group: null,
},
};
export const succeededPaymentIntentExample = {
id: "payment_intent.succeeded",
name: "payment_intent.succeeded",
icon: "stripe",
payload: {
id: "pi_3Nk30FI0XSgju2ur1OohIT9i",
object: "payment_intent",
amount: 2000,
amount_capturable: 0,
amount_details: {
tip: {},
},
amount_received: 2000,
application: null,
application_fee_amount: null,
automatic_payment_methods: null,
canceled_at: null,
cancellation_reason: null,
capture_method: "automatic",
client_secret: "pi_3Nk30FI0XSgju2ur1OohIT9i_secret_VPcrQS7qSyPZ4GL7BfQRA1X2y",
confirmation_method: "automatic",
created: 1693219743,
currency: "usd",
customer: null,
description: "(created by Stripe CLI)",
invoice: null,
last_payment_error: null,
latest_charge: "ch_3Nk30FI0XSgju2ur150Nf8Jf",
livemode: false,
metadata: {},
next_action: null,
on_behalf_of: null,
payment_method: "pm_1Nk30FI0XSgju2urEXQYKJsw",
payment_method_options: {
card: {
installments: null,
mandate_options: null,
network: null,
request_three_d_secure: "automatic",
},
},
payment_method_types: ["card"],
processing: null,
receipt_email: null,
review: null,
setup_future_usage: null,
shipping: {
address: {
city: "San Francisco",
country: "US",
line1: "510 Townsend St",
line2: null,
postal_code: "94103",
state: "CA",
},
carrier: null,
name: "Jenny Rosen",
phone: null,
tracking_number: null,
},
source: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: "succeeded",
transfer_data: null,
transfer_group: null,
},
};
export const cancelledPaymentIntentExample = {
id: "payment_intent.canceled",
name: "payment_intent.canceled",
icon: "stripe",
payload: {
id: "pi_3Nk316I0XSgju2ur0WYHIexr",
object: "payment_intent",
amount: 2000,
amount_capturable: 0,
amount_details: {
tip: {},
},
amount_received: 0,
application: null,
application_fee_amount: null,
automatic_payment_methods: null,
canceled_at: 1693219796,
cancellation_reason: "requested_by_customer",
capture_method: "automatic",
client_secret: "pi_3Nk316I0XSgju2ur0WYHIexr_secret_NWXEzMmLe3IXZIW0HahXUXo9w",
confirmation_method: "automatic",
created: 1693219796,
currency: "usd",
customer: null,
description: "(created by Stripe CLI)",
invoice: null,
last_payment_error: null,
latest_charge: null,
livemode: false,
metadata: {},
next_action: null,
on_behalf_of: null,
payment_method: null,
payment_method_options: {
card: {
installments: null,
mandate_options: null,
network: null,
request_three_d_secure: "automatic",
},
},
payment_method_types: ["card"],
processing: null,
receipt_email: null,
review: null,
setup_future_usage: null,
shipping: null,
source: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: "canceled",
transfer_data: null,
transfer_group: null,
},
};
export const amountCapturablePaymentIntentExample = {
id: "payment_intent.amount_capturable_updated",
name: "payment_intent.amount_capturable_updated",
icon: "stripe",
payload: {
id: "pi_3Nk32UI0XSgju2ur0mIrhcYD",
object: "payment_intent",
amount: 2000,
amount_capturable: 2000,
amount_details: {
tip: {},
},
amount_received: 0,
application: null,
application_fee_amount: null,
automatic_payment_methods: null,
canceled_at: null,
cancellation_reason: null,
capture_method: "manual",
client_secret: "pi_3Nk32UI0XSgju2ur0mIrhcYD_secret_JyfSHNompZV9sipG3wBgfWf1s",
confirmation_method: "manual",
created: 1693219882,
currency: "usd",
customer: null,
description: "(created by Stripe CLI)",
invoice: null,
last_payment_error: null,
latest_charge: "ch_3Nk32UI0XSgju2ur0k1SMSZ4",
livemode: false,
metadata: {},
next_action: null,
on_behalf_of: null,
payment_method: "pm_1Nk32UI0XSgju2uriPepd9pr",
payment_method_options: {
card: {
installments: null,
mandate_options: null,
network: null,
request_three_d_secure: "automatic",
},
},
payment_method_types: ["card"],
processing: null,
receipt_email: null,
review: null,
setup_future_usage: null,
shipping: null,
source: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: "requires_capture",
transfer_data: null,
transfer_group: null,
},
};
export const failedPaymentIntentExample = {
id: "payment_intent.payment_failed",
name: "payment_intent.payment_failed",
icon: "stripe",
payload: {
id: "pi_3Nk341I0XSgju2ur1ckiktWk",
object: "payment_intent",
amount: 2000,
amount_capturable: 0,
amount_details: {
tip: {},
},
amount_received: 0,
application: null,
application_fee_amount: null,
automatic_payment_methods: null,
canceled_at: null,
cancellation_reason: null,
capture_method: "automatic",
client_secret: "pi_3Nk341I0XSgju2ur1ckiktWk_secret_3Km19PEIXajFEZRi9qi2VU2d3",
confirmation_method: "automatic",
created: 1693219977,
currency: "usd",
customer: null,
description: "(created by Stripe CLI)",
invoice: null,
last_payment_error: {
charge: "ch_3Nk341I0XSgju2ur1UZC5yvb",
code: "card_declined",
decline_code: "generic_decline",
doc_url: "https://stripe.com/docs/error-codes/card-declined",
message: "Your card was declined.",
payment_method: {
id: "pm_1Nk341I0XSgju2uraNBls6mm",
object: "payment_method",
billing_details: {
address: {
city: null,
country: null,
line1: null,
line2: null,
postal_code: null,
state: null,
},
email: null,
name: null,
phone: null,
},
card: {
brand: "visa",
checks: {
address_line1_check: null,
address_postal_code_check: null,
cvc_check: null,
},
country: "US",
exp_month: 8,
exp_year: 2024,
fingerprint: "LvNwBVtV2ETBNH8a",
funding: "credit",
generated_from: null,
last4: "0002",
networks: {
available: ["visa"],
preferred: null,
},
three_d_secure_usage: {
supported: true,
},
wallet: null,
},
created: 1693219977,
customer: null,
livemode: false,
metadata: {},
type: "card",
},
type: "card_error",
},
latest_charge: "ch_3Nk341I0XSgju2ur1UZC5yvb",
livemode: false,
metadata: {},
next_action: null,
on_behalf_of: null,
payment_method: null,
payment_method_options: {
card: {
installments: null,
mandate_options: null,
network: null,
request_three_d_secure: "automatic",
},
},
payment_method_types: ["card"],
processing: null,
receipt_email: null,
review: null,
setup_future_usage: null,
shipping: null,
source: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: "requires_payment_method",
transfer_data: null,
transfer_group: null,
},
};
+212
View File
@@ -621,6 +621,218 @@ export class Stripe implements StripeIntegration {
onPersonUpdated(params?: TriggerParams) {
return createTrigger(this.source, events.onPersonUpdated, params ?? { connect: false });
}
/**
* Occurs on any payment_intent.* event. Accepts an optional array of events to filter on. By default it will listen to all payment_intent.* events.
*
* @example
* ```ts
* stripe.onPaymentIntent({ events: ["payment_intent.created", "payment_intent.succeeded"] })
* ```
*
* You can detect the event name in your job by using the `ctx.event.name` property:
*
* ```ts
* client.defineJob({
* id: "stripe-example",
* name: "Stripe Example",
* version: "0.1.0",
* trigger: stripe.onPaymentIntent({ events: ["payment_intent.created", "payment_intent.succeeded"] }),
* run: async (payload, io, ctx) => {
* console.log(ctx.event.name); // "payment_intent.created" or "payment_intent.succeeded"
* },
* });
* ```
*/
onPaymentIntent(
params?: TriggerParams & {
events?: Array<
| "payment_intent.created"
| "payment_intent.succeeded"
| "payment_intent.canceled"
| "payment_intent.processing"
| "payment_intent.requires_action"
| "payment_intent.amount_capturable_updated"
| "payment_intent.payment_failed"
| "payment_intent.partially_funded"
>;
}
) {
const event = {
...events.onPaymentIntent,
name: params?.events ?? events.onPaymentIntent.name,
};
return createTrigger(this.source, event, params ?? { connect: false });
}
/**
* Occurs when a new PaymentIntent is created..
* */
onPaymentIntentCreated(params?: TriggerParams) {
return createTrigger(this.source, events.onPaymentIntentCreated, params ?? { connect: false });
}
/**
* Occurs when a PaymentIntent has successfully completed payment.
* */
onPaymentIntentSucceeded(params?: TriggerParams) {
return createTrigger(
this.source,
events.onPaymentIntentSucceeded,
params ?? { connect: false }
);
}
/**
* Occurs when a PaymentIntent is canceled.
* */
onPaymentIntentCancelled(params?: TriggerParams) {
return createTrigger(this.source, events.onPaymentIntentCanceled, params ?? { connect: false });
}
/**
* Occurs when a PaymentIntent has started processing.
* */
onPaymentIntentProcessing(params?: TriggerParams) {
return createTrigger(
this.source,
events.onPaymentIntentProcessing,
params ?? { connect: false }
);
}
/**
* Occurs when a PaymentIntent transitions to requires_action state
* */
onPaymentIntentRequiresAction(params?: TriggerParams) {
return createTrigger(
this.source,
events.onPaymentIntentRequiresAction,
params ?? { connect: false }
);
}
/**
* Occurs when a PaymentIntent has funds to be captured. Check the amount_capturable property on the PaymentIntent to determine the amount that can be captured. You may capture the PaymentIntent with an amount_to_capture value up to the specified amount. [Learn more about capturing PaymentIntents](https://stripe.com/docs/api/payment_intents/capture)
* */
onPaymentIntentAmountCapturableUpdated(params?: TriggerParams) {
return createTrigger(
this.source,
events.onPaymentIntentAmountCapturableUpdated,
params ?? { connect: false }
);
}
/**
* Occurs when a PaymentIntent has failed the attempt to create a payment method or a payment.
* */
onPaymentIntentPaymentFailed(params?: TriggerParams) {
return createTrigger(
this.source,
events.onPaymentIntentPaymentFailed,
params ?? { connect: false }
);
}
/**
* Occurs when funds are applied to a customer_balance PaymentIntent and the amount_remaining changes.
* */
onPaymentIntentPartiallyFunded(params?: TriggerParams) {
return createTrigger(
this.source,
events.onPaymentIntentPartiallyFunded,
params ?? { connect: false }
);
}
/**
* Occurs on any payout.* event. Accepts an optional array of events to filter on. By default it will listen to all payout.* events.
*
* @example
* ```ts
* stripe.onPayout({ events: ["payout.created", "payout.paid"] })
* ```
*
* You can detect the event name in your job by using the `ctx.event.name` property:
*
* ```ts
* client.defineJob({
* id: "stripe-example",
* name: "Stripe Example",
* version: "0.1.0",
* trigger: stripe.onPayout({ events: ["payout.created", "payout.paid"] }),
* run: async (payload, io, ctx) => {
* console.log(ctx.event.name); // "payout.created" or "payout.paid"
* },
* });
* ```
*/
onPayout(
params?: TriggerParams & {
events?: Array<
| "payout.canceled"
| "payout.created"
| "payout.failed"
| "payout.paid"
| "payout.reconciliation_completed"
| "payout.updated"
>;
}
) {
const event = {
...events.onPayout,
name: params?.events ?? events.onPayout.name,
};
return createTrigger(this.source, event, params ?? { connect: false });
}
/**
* Occurs whenever a payout is created.
* */
onPayoutCreated(params?: TriggerParams) {
return createTrigger(this.source, events.onPayoutCreated, params ?? { connect: false });
}
/**
* Occurs whenever a payout is updated.
* */
onPayoutUpdated(params?: TriggerParams) {
return createTrigger(this.source, events.onPayoutUpdated, params ?? { connect: false });
}
/**
* Occurs whenever a payout is canceled.
* */
onPayoutCanceled(params?: TriggerParams) {
return createTrigger(this.source, events.onPayoutCancelled, params ?? { connect: false });
}
/**
* Occurs whenever a payout attempt fails.
* */
onPayoutFailed(params?: TriggerParams) {
return createTrigger(this.source, events.onPayoutFailed, params ?? { connect: false });
}
/**
* Occurs whenever a payout is expected to be available in the destination account. If the payout fails, a `payout.failed` notification is also sent, at a later time.
* */
onPayoutPaid(params?: TriggerParams) {
return createTrigger(this.source, events.onPayoutPaid, params ?? { connect: false });
}
/**
* Occurs whenever balance transactions paid out in an automatic payout can be queried.
* */
onPayoutReconciliationCompleted(params?: TriggerParams) {
return createTrigger(
this.source,
events.onPayoutReconciliationCompleted,
params ?? { connect: false }
);
}
}
export type TriggerParams = {
+5
View File
@@ -81,3 +81,8 @@ export type OnExternalAccountEvent =
ExtractWebhookPayload<Stripe.DiscriminatedEvent.AccountExternalAccountEvent>;
export type OnPersonEvent = ExtractWebhookPayload<Stripe.DiscriminatedEvent.PersonEvent>;
export type OnPaymentIntentEvent =
ExtractWebhookPayload<Stripe.DiscriminatedEvent.PaymentIntentEvent>;
export type OnPayoutEvent = ExtractWebhookPayload<Stripe.DiscriminatedEvent.PayoutEvent>;