Skip to content

Commit

Permalink
add triggers for subscription.payment_failed and payment_succeeded (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
charliecruzan-stripe authored Jan 18, 2023
1 parent 7c83f6f commit f684053
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/fixtures/triggers.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ var Events = map[string]string{
"subscription_schedule.created": "triggers/subscription_schedule.created.json",
"subscription_schedule.released": "triggers/subscription_schedule.released.json",
"subscription_schedule.updated": "triggers/subscription_schedule.updated.json",
"subscription.payment_succeeded": "triggers/subscription.payment_succeeded.json",
"subscription.payment_failed": "triggers/subscription.payment_failed.json",
"quote.created": "triggers/quote.created.json",
"quote.canceled": "triggers/quote.canceled.json",
"quote.finalized": "triggers/quote.finalized.json",
Expand Down
90 changes: 90 additions & 0 deletions pkg/fixtures/triggers/subscription.payment_failed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "payment_method",
"path": "/v1/payment_methods",
"method": "post",
"params": {
"type": "card",
"card": {
"number": "4000000000000341",
"exp_month": 10,
"exp_year": 2026,
"cvc": 314
}
}
},
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
"name": "SubscriptionTestCustomer",
"description": "(created by Stripe CLI)"
}
},
{
"name": "attach_payment_method",
"path": "/v1/payment_methods/${payment_method:id}/attach",
"method": "post",
"params": {
"customer": "${customer:id}"
}
},
{
"name": "default_payment_method",
"path": "/v1/customers/${customer:id}",
"method": "post",
"params": {
"invoice_settings": {
"default_payment_method": "${payment_method:id}"
}
}
},
{
"name": "product",
"path": "/v1/products",
"method": "post",
"params": {
"name": "SubscriptionTestProduct",
"description": "(created by Stripe CLI)"
}
},
{
"name": "price",
"path": "/v1/prices",
"method": "post",
"params": {
"nickname": "SubscriptionTestPrice",
"product": "${product:id}",
"unit_amount": 2000,
"currency": "usd",
"recurring": {
"interval": "month"
}
}
},
{
"name": "subscription",
"path": "/v1/subscriptions",
"method": "post",
"params": {
"customer": "${customer:id}",
"items": [
{
"price": "${price:id}"
}
]
}
},
{
"name": "invoice",
"path": "/v1/invoices/${subscription:latest_invoice}",
"method": "get",
"params": {}
}
]
}
90 changes: 90 additions & 0 deletions pkg/fixtures/triggers/subscription.payment_succeeded.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "payment_method",
"path": "/v1/payment_methods",
"method": "post",
"params": {
"type": "card",
"card": {
"number": "4242424242424242",
"exp_month": 10,
"exp_year": 2026,
"cvc": 314
}
}
},
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
"name": "SubscriptionTestCustomer",
"description": "(created by Stripe CLI)"
}
},
{
"name": "attach_payment_method",
"path": "/v1/payment_methods/${payment_method:id}/attach",
"method": "post",
"params": {
"customer": "${customer:id}"
}
},
{
"name": "default_payment_method",
"path": "/v1/customers/${customer:id}",
"method": "post",
"params": {
"invoice_settings": {
"default_payment_method": "${payment_method:id}"
}
}
},
{
"name": "product",
"path": "/v1/products",
"method": "post",
"params": {
"name": "SubscriptionTestProduct",
"description": "(created by Stripe CLI)"
}
},
{
"name": "price",
"path": "/v1/prices",
"method": "post",
"params": {
"nickname": "SubscriptionTestPrice",
"product": "${product:id}",
"unit_amount": 2000,
"currency": "usd",
"recurring": {
"interval": "month"
}
}
},
{
"name": "subscription",
"path": "/v1/subscriptions",
"method": "post",
"params": {
"customer": "${customer:id}",
"items": [
{
"price": "${price:id}"
}
]
}
},
{
"name": "invoice",
"path": "/v1/invoices/${subscription:latest_invoice}",
"method": "get",
"params": {}
}
]
}

0 comments on commit f684053

Please sign in to comment.