Skip to content

Commit 7780741

Browse files
committed
update to reflect changes for adding subscription and mid-cycle upgrade
1 parent add3837 commit 7780741

File tree

2 files changed

+49
-81
lines changed

2 files changed

+49
-81
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ You will be assessing the estimated revenue for 3 different subscription product
1010

1111
## Requirements
1212
- Return a table for each product that lists out a subscription per row.
13-
- The columns should be the following: customer email, product name, ...months 1-12, life time value for subscription. The final row should contain usd totals for each month.
13+
- The columns should be the following: customer email, product name, ...months 1-12, lifetime value for subscription. The final row should contain usd totals for each month.
14+
- Using the Stripe API, create a new customer and subscribe them to the following:
15+
- Price: `${price_monthly_crossclip_basic:id}`
16+
- Coupon: `${coupon_5_off_3_months:id}`
17+
- Trial: 30 days
18+
- Currency: `gbp`
19+
- For your created subscription, during the 5th month perform a mid-cycle upgrade with proration on the 15th to the following:
20+
- Price: `${price_monthly_crossclip_premium:id}`
1421
- **You can display these tables via HTML or command line output.**
1522

1623
| Customer Email | Product Name | {endOfMonth date} 1 | {endOfMonth} 2 | {endOfMonth} 3 | {endOfMonth} 4 | {endOfMonth} 5 | {endOfMonth} 6 | {endOfMonth} 7 | {endOfMonth} 8 | {endOfMonth} 9 | {endOfMonth} 10 | {endOfMonth} 11 | {endOfMonth} 12 | Life Time Value |

fixtures/seed.json

Lines changed: 41 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,21 @@
11
{
22
"fixtures": [
33
{
4-
"name": "customer_daniel",
5-
"path": "/v1/customers",
6-
"method": "post",
7-
"params": {
8-
"test_clock": "${.env:STRIPE_TEST_CLOCK}",
9-
"name": "Daniel Smith",
10-
"email": "[email protected]"
11-
}
12-
},
13-
{
14-
"name": "payment_method_daniel",
15-
"path": "/v1/payment_methods/pm_card_visa/attach",
16-
"method": "post",
17-
"params": {
18-
"customer": "${customer_daniel:id}"
19-
}
20-
},
21-
{
22-
"name": "customer_mayra",
4+
"name": "customer_diego",
235
"path": "/v1/customers",
246
"method": "post",
257
"params": {
268
"test_clock": "${.env:STRIPE_TEST_CLOCK}",
279
"name": "Mayra Rodriguez",
28-
"email": "mayra[email protected]"
10+
"email": "diego[email protected]"
2911
}
3012
},
3113
{
32-
"name": "payment_method_mayra",
14+
"name": "payment_method_diego",
3315
"path": "/v1/payment_methods/pm_card_visa_debit/attach",
3416
"method": "post",
3517
"params": {
36-
"customer": "${customer_mayra:id}"
18+
"customer": "${customer_diego:id}"
3719
}
3820
},
3921
{
@@ -118,10 +100,12 @@
118100
}
119101
},
120102
{
121-
"name": "price_monthly_crossclip",
103+
"name": "price_monthly_crossclip_basic",
122104
"path": "/v1/prices",
123105
"method": "post",
124106
"params": {
107+
"lookup_key": "monthly_crossclip_basic",
108+
"transfer_lookup_key": true,
125109
"unit_amount": 2000,
126110
"currency": "usd",
127111
"recurring": {
@@ -138,6 +122,29 @@
138122
}
139123
}
140124
},
125+
{
126+
"name": "price_monthly_crossclip_premium",
127+
"path": "/v1/prices",
128+
"method": "post",
129+
"params": {
130+
"lookup_key": "monthly_crossclip_premium",
131+
"transfer_lookup_key": true,
132+
"unit_amount": 4500,
133+
"currency": "usd",
134+
"recurring": {
135+
"interval": "month"
136+
},
137+
"product": "${crossclip:id}",
138+
"currency_options": {
139+
"gbp": {
140+
"unit_amount": 3450
141+
},
142+
"eur": {
143+
"unit_amount": 4150
144+
}
145+
}
146+
}
147+
},
141148
{
142149
"name": "price_6months_talkstudio",
143150
"path": "/v1/prices",
@@ -183,95 +190,49 @@
183190
}
184191
},
185192
{
186-
"name": "subscription_daniel_crossclip",
187-
"path": "/v1/subscriptions",
188-
"method": "post",
189-
"params": {
190-
"customer": "${customer_daniel:id}",
191-
"items": [
192-
{
193-
"price": "${price_monthly_crossclip:id}"
194-
}
195-
],
196-
"default_payment_method": "${payment_method_daniel:id}",
197-
"trial_period_days": 30,
198-
"coupon": "${coupon_10_off:id}"
199-
}
200-
},
201-
{
202-
"name": "subscription_daniel_talkstudio",
203-
"path": "/v1/subscriptions",
204-
"method": "post",
205-
"params": {
206-
"customer": "${customer_daniel:id}",
207-
"items": [
208-
{
209-
"price": "${price_6months_talkstudio:id}"
210-
}
211-
],
212-
"default_payment_method": "${payment_method_daniel:id}",
213-
"cancel_at_period_end": true
214-
}
215-
},
216-
{
217-
"name": "subscription_daniel_videoeditor",
218-
"path": "/v1/subscriptions",
219-
"method": "post",
220-
"params": {
221-
"customer": "${customer_daniel:id}",
222-
"items": [
223-
{
224-
"price": "${price_3months_videoeditor:id}"
225-
}
226-
],
227-
"default_payment_method": "${payment_method_daniel:id}",
228-
"trial_period_days": 60
229-
}
230-
},
231-
{
232-
"name": "subscription_mayra_crossclip",
193+
"name": "subscription_diego_crossclip",
233194
"path": "/v1/subscriptions",
234195
"method": "post",
235196
"params": {
236-
"customer": "${customer_mayra:id}",
197+
"customer": "${customer_diego:id}",
237198
"items": [
238199
{
239-
"price": "${price_monthly_crossclip:id}"
200+
"price": "${price_monthly_crossclip_basic:id}"
240201
}
241202
],
242-
"default_payment_method": "${payment_method_mayra:id}",
203+
"default_payment_method": "${payment_method_diego:id}",
243204
"coupon": "${coupon_5_off_3_months:id}",
244205
"currency": "eur"
245206
}
246207
},
247208
{
248-
"name": "subscription_mayra_talkstudio",
209+
"name": "subscription_diego_talkstudio",
249210
"path": "/v1/subscriptions",
250211
"method": "post",
251212
"params": {
252-
"customer": "${customer_mayra:id}",
213+
"customer": "${customer_diego:id}",
253214
"items": [
254215
{
255216
"price": "${price_6months_talkstudio:id}"
256217
}
257218
],
258-
"default_payment_method": "${payment_method_mayra:id}",
219+
"default_payment_method": "${payment_method_diego:id}",
259220
"trial_period_days": 90,
260221
"currency": "eur"
261222
}
262223
},
263224
{
264-
"name": "subscription_mayra_videoeditor",
225+
"name": "subscription_diego_videoeditor",
265226
"path": "/v1/subscriptions",
266227
"method": "post",
267228
"params": {
268-
"customer": "${customer_mayra:id}",
229+
"customer": "${customer_diego:id}",
269230
"items": [
270231
{
271232
"price": "${price_3months_videoeditor:id}"
272233
}
273234
],
274-
"default_payment_method": "${payment_method_mayra:id}",
235+
"default_payment_method": "${payment_method_diego:id}",
275236
"cancel_at_period_end": true,
276237
"currency": "eur"
277238
}
@@ -284,7 +245,7 @@
284245
"customer": "${customer_santiago:id}",
285246
"items": [
286247
{
287-
"price": "${price_monthly_crossclip:id}"
248+
"price": "${price_monthly_crossclip_basic:id}"
288249
}
289250
],
290251
"default_payment_method": "${payment_method_santiago:id}",

0 commit comments

Comments
 (0)