Skip to content

Commit 760f5de

Browse files
committed
Adding additional stripe triggers and added initial stripe integration docs
1 parent de7e8c7 commit 760f5de

File tree

7 files changed

+801
-12
lines changed

7 files changed

+801
-12
lines changed

.changeset/tender-plants-marry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/stripe": patch
3+
---
4+
5+
Adding additional Stripe triggers for account.updated, account.external_account._, customer._, person._, and charge._

docs/integrations/apis/stripe.mdx

Lines changed: 215 additions & 0 deletions
Large diffs are not rendered by default.

docs/mint.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"integrations/apis/openai"
194194
]
195195
},
196+
"integrations/apis/stripe",
196197
"integrations/apis/plain",
197198
{
198199
"group": "Resend",

integrations/stripe/src/events.ts

Lines changed: 260 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@ import {
66
pausedSubscriptionExample,
77
updatedSubscriptionExample,
88
} from "./examples";
9-
import { OnCheckoutSession, OnCustomerSubscription, OnPriceEvent, OnProductEvent } from "./types";
9+
import {
10+
OnAccountEvent,
11+
OnChargeEvent,
12+
OnCheckoutSession,
13+
OnCustomerEvent,
14+
OnCustomerSubscription,
15+
OnExternalAccountEvent,
16+
OnPersonEvent,
17+
OnPriceEvent,
18+
OnProductEvent,
19+
} from "./types";
1020

1121
export const onPriceCreated: EventSpecification<OnPriceEvent> = {
1222
name: "price.created",
@@ -451,3 +461,252 @@ export const onCustomerSubscriptionUpdated: EventSpecification<OnCustomerSubscri
451461
{ label: "Status", text: payload.status },
452462
],
453463
};
464+
465+
export const onAccountUpdated: EventSpecification<OnAccountEvent> = {
466+
name: "account.updated",
467+
title: "On Account Updated",
468+
source: "stripe.com",
469+
icon: "stripe",
470+
examples: [],
471+
parsePayload: (payload) => payload as OnAccountEvent,
472+
runProperties: (payload) => [
473+
{ label: "Account ID", text: payload.id },
474+
...(payload.business_type ? [{ label: "Business Type", text: payload.business_type }] : []),
475+
],
476+
};
477+
478+
export const onCustomer: EventSpecification<OnCustomerEvent> = {
479+
name: ["customer.created", "customer.deleted", "customer.updated"],
480+
title: "On Customer Event",
481+
source: "stripe.com",
482+
icon: "stripe",
483+
examples: [],
484+
parsePayload: (payload) => payload as OnCustomerEvent,
485+
runProperties: (payload) => [{ label: "Customer ID", text: payload.id }],
486+
};
487+
488+
export const onCustomerCreated: EventSpecification<OnCustomerEvent> = {
489+
name: "customer.created",
490+
title: "On Customer Created",
491+
source: "stripe.com",
492+
icon: "stripe",
493+
examples: [],
494+
parsePayload: (payload) => payload as OnCustomerEvent,
495+
runProperties: (payload) => [{ label: "Customer ID", text: payload.id }],
496+
};
497+
498+
export const onCustomerDeleted: EventSpecification<OnCustomerEvent> = {
499+
name: "customer.deleted",
500+
title: "On Customer Deleted",
501+
source: "stripe.com",
502+
icon: "stripe",
503+
examples: [],
504+
parsePayload: (payload) => payload as OnCustomerEvent,
505+
runProperties: (payload) => [{ label: "Customer ID", text: payload.id }],
506+
};
507+
508+
export const onCustomerUpdated: EventSpecification<OnCustomerEvent> = {
509+
name: "customer.updated",
510+
title: "On Customer Updated",
511+
source: "stripe.com",
512+
icon: "stripe",
513+
examples: [],
514+
parsePayload: (payload) => payload as OnCustomerEvent,
515+
runProperties: (payload) => [{ label: "Customer ID", text: payload.id }],
516+
};
517+
518+
export const onCharge: EventSpecification<OnChargeEvent> = {
519+
name: [
520+
"charge.captured",
521+
"charge.expired",
522+
"charge.failed",
523+
"charge.pending",
524+
"charge.refunded",
525+
"charge.succeeded",
526+
"charge.updated",
527+
],
528+
title: "On Charge Event",
529+
source: "stripe.com",
530+
icon: "stripe",
531+
examples: [],
532+
parsePayload: (payload) => payload as OnChargeEvent,
533+
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
534+
};
535+
536+
export const onChargeCaptured: EventSpecification<OnChargeEvent> = {
537+
name: "charge.captured",
538+
title: "On Charge Captured",
539+
source: "stripe.com",
540+
icon: "stripe",
541+
examples: [],
542+
parsePayload: (payload) => payload as OnChargeEvent,
543+
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
544+
};
545+
546+
export const onChargeExpired: EventSpecification<OnChargeEvent> = {
547+
name: "charge.expired",
548+
title: "On Charge Expired",
549+
source: "stripe.com",
550+
icon: "stripe",
551+
examples: [],
552+
parsePayload: (payload) => payload as OnChargeEvent,
553+
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
554+
};
555+
556+
export const onChargeFailed: EventSpecification<OnChargeEvent> = {
557+
name: "charge.failed",
558+
title: "On Charge Failed",
559+
source: "stripe.com",
560+
icon: "stripe",
561+
examples: [],
562+
parsePayload: (payload) => payload as OnChargeEvent,
563+
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
564+
};
565+
566+
export const onChargePending: EventSpecification<OnChargeEvent> = {
567+
name: "charge.pending",
568+
title: "On Charge Pending",
569+
source: "stripe.com",
570+
icon: "stripe",
571+
examples: [],
572+
parsePayload: (payload) => payload as OnChargeEvent,
573+
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
574+
};
575+
576+
export const onChargeRefunded: EventSpecification<OnChargeEvent> = {
577+
name: "charge.refunded",
578+
title: "On Charge Refunded",
579+
source: "stripe.com",
580+
icon: "stripe",
581+
examples: [],
582+
parsePayload: (payload) => payload as OnChargeEvent,
583+
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
584+
};
585+
586+
export const onChargeSucceeded: EventSpecification<OnChargeEvent> = {
587+
name: "charge.succeeded",
588+
title: "On Charge Succeeded",
589+
source: "stripe.com",
590+
icon: "stripe",
591+
examples: [],
592+
parsePayload: (payload) => payload as OnChargeEvent,
593+
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
594+
};
595+
596+
export const onChargeUpdated: EventSpecification<OnChargeEvent> = {
597+
name: "charge.updated",
598+
title: "On Charge Updated",
599+
source: "stripe.com",
600+
icon: "stripe",
601+
examples: [],
602+
parsePayload: (payload) => payload as OnChargeEvent,
603+
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
604+
};
605+
606+
export const onExternalAccount: EventSpecification<OnExternalAccountEvent> = {
607+
name: [
608+
"account.external_account.created",
609+
"account.external_account.deleted",
610+
"account.external_account.updated",
611+
],
612+
title: "On External Account Event",
613+
source: "stripe.com",
614+
icon: "stripe",
615+
examples: [],
616+
parsePayload: (payload) => payload as OnExternalAccountEvent,
617+
runProperties: (payload) => [
618+
{ label: "Type", text: payload.object },
619+
{ label: payload.object === "bank_account" ? "Bank Account ID" : "Card ID", text: payload.id },
620+
],
621+
};
622+
623+
export const onExternalAccountCreated: EventSpecification<OnExternalAccountEvent> = {
624+
name: "account.external_account.created",
625+
title: "On External Account Created",
626+
source: "stripe.com",
627+
icon: "stripe",
628+
examples: [],
629+
parsePayload: (payload) => payload as OnExternalAccountEvent,
630+
runProperties: (payload) => [
631+
{ label: "Type", text: payload.object },
632+
{ label: payload.object === "bank_account" ? "Bank Account ID" : "Card ID", text: payload.id },
633+
],
634+
};
635+
636+
export const onExternalAccountDeleted: EventSpecification<OnExternalAccountEvent> = {
637+
name: "account.external_account.deleted",
638+
title: "On External Account Deleted",
639+
source: "stripe.com",
640+
icon: "stripe",
641+
examples: [],
642+
parsePayload: (payload) => payload as OnExternalAccountEvent,
643+
runProperties: (payload) => [
644+
{ label: "Type", text: payload.object },
645+
{ label: payload.object === "bank_account" ? "Bank Account ID" : "Card ID", text: payload.id },
646+
],
647+
};
648+
649+
export const onExternalAccountUpdated: EventSpecification<OnExternalAccountEvent> = {
650+
name: "account.external_account.updated",
651+
title: "On External Account Updated",
652+
source: "stripe.com",
653+
icon: "stripe",
654+
examples: [],
655+
parsePayload: (payload) => payload as OnExternalAccountEvent,
656+
runProperties: (payload) => [
657+
{ label: "Type", text: payload.object },
658+
{ label: payload.object === "bank_account" ? "Bank Account ID" : "Card ID", text: payload.id },
659+
],
660+
};
661+
662+
export const onPerson: EventSpecification<OnPersonEvent> = {
663+
name: ["person.created", "person.deleted", "person.updated"],
664+
title: "On Person Event",
665+
source: "stripe.com",
666+
icon: "stripe",
667+
examples: [],
668+
parsePayload: (payload) => payload as OnPersonEvent,
669+
runProperties: (payload) => [
670+
{ label: "Person ID", text: payload.id },
671+
{ label: "Account", text: payload.account },
672+
],
673+
};
674+
675+
export const onPersonCreated: EventSpecification<OnPersonEvent> = {
676+
name: "person.created",
677+
title: "On Person Created",
678+
source: "stripe.com",
679+
icon: "stripe",
680+
examples: [],
681+
parsePayload: (payload) => payload as OnPersonEvent,
682+
runProperties: (payload) => [
683+
{ label: "Person ID", text: payload.id },
684+
{ label: "Account", text: payload.account },
685+
],
686+
};
687+
688+
export const onPersonDeleted: EventSpecification<OnPersonEvent> = {
689+
name: "person.deleted",
690+
title: "On Person Deleted",
691+
source: "stripe.com",
692+
icon: "stripe",
693+
examples: [],
694+
parsePayload: (payload) => payload as OnPersonEvent,
695+
runProperties: (payload) => [
696+
{ label: "Person ID", text: payload.id },
697+
{ label: "Account", text: payload.account },
698+
],
699+
};
700+
701+
export const onPersonUpdated: EventSpecification<OnPersonEvent> = {
702+
name: "person.updated",
703+
title: "On Person Updated",
704+
source: "stripe.com",
705+
icon: "stripe",
706+
examples: [],
707+
parsePayload: (payload) => payload as OnPersonEvent,
708+
runProperties: (payload) => [
709+
{ label: "Person ID", text: payload.id },
710+
{ label: "Account", text: payload.account },
711+
],
712+
};

0 commit comments

Comments
 (0)