Coverage for app/backend/src/tests/test_donations.py: 100%

324 statements  

« prev     ^ index     » next       coverage.py v7.17.2, created at 2026-11-10 09:48 +0000

1import hashlib 

2import hmac 

3import json 

4import time 

5from unittest.mock import patch 

6 

7import grpc 

8import pytest 

9import stripe 

10from google.protobuf import empty_pb2 

11from sqlalchemy import select 

12 

13from couchers.config import config 

14from couchers.db import session_scope 

15from couchers.jobs.handlers import update_badges 

16from couchers.models import DonationInitiation, DonationType, Invoice, InvoiceType, User, UserBadge 

17from couchers.proto import donations_pb2 

18from couchers.proto.google.api import httpbody_pb2 

19from tests.fixtures.db import generate_user 

20from tests.fixtures.feature_flags import FeatureFlags 

21from tests.fixtures.sessions import donations_session, real_stripe_session 

22 

23 

24@pytest.fixture 

25def stripe_config() -> None: 

26 # An autouse fixture runs before non-autouse fixtures of the same scope. 

27 config.STRIPE_API_KEY = "dummy_api_key" 

28 config.STRIPE_WEBHOOK_SECRET = "dummy_webhook_secret" 

29 config.STRIPE_RECURRING_PRODUCT_ID = "price_1KIbmbIfR5z29g5kFWPEUnC6" 

30 config.STRIPE_YEARLY_RECURRING_PRODUCT_ID = "price_1UFQSGIfR5z29g5koIy21lYR" 

31 config.MERCH_SHOP_URL = "https://shop.couchershq.org" 

32 

33 

34def test_donations_disabled(db, feature_flags: FeatureFlags): 

35 feature_flags.set("donations_enabled", False) 

36 _, token = generate_user() 

37 

38 with donations_session(token) as donations: 

39 with pytest.raises(grpc.RpcError) as e: 

40 donations.InitiateDonation(donations_pb2.InitiateDonationReq(amount=100)) 

41 assert e.value.code() == grpc.StatusCode.UNAVAILABLE 

42 assert e.value.details() == "Donations are currently disabled." 

43 

44 

45def test_one_time_donation_flow(db, stripe_config): 

46 user, token = generate_user() 

47 user_email = user.email 

48 user_id = user.id 

49 

50 ## User first makes a req to Donations.InitiateDonation 

51 with donations_session(token) as donations: 

52 with patch("couchers.servicers.donations.stripe") as mock: 

53 mock.Customer.create.return_value = type("__MockCustomer", (), {"id": "cus_Pv4uq0gT0rDZWN"}) 

54 mock.checkout.Session.create.return_value = type("__MockCheckoutSession", (), one_time_STRIPE_SESSION) 

55 

56 res = donations.InitiateDonation( 

57 donations_pb2.InitiateDonationReq( 

58 amount=100, 

59 frequency=donations_pb2.DONATION_FREQUENCY_ONE_TIME, 

60 source="test-one-time", 

61 ) 

62 ) 

63 

64 mock.Customer.create.assert_called_once_with( 

65 email=user_email, metadata={"user_id": user_id}, api_key="dummy_api_key" 

66 ) 

67 

68 with session_scope() as session: 

69 donation_initiation_id = session.execute(select(DonationInitiation.id)).scalar_one() 

70 

71 mock.checkout.Session.create.assert_called_once_with( 

72 client_reference_id=str(user_id), 

73 submit_type="donate", 

74 customer="cus_Pv4uq0gT0rDZWN", 

75 success_url="http://localhost:3000/donate?success=true", 

76 cancel_url="http://localhost:3000/donate?cancelled=true", 

77 payment_method_types=["card"], 

78 mode="payment", 

79 line_items=[ 

80 { 

81 "price_data": { 

82 "currency": "usd", 

83 "unit_amount": 10000, 

84 "product_data": { 

85 "name": "Couchers financial supporter (one-time)", 

86 "images": ["https://couchers.org/img/share.jpg"], 

87 }, 

88 }, 

89 "quantity": 1, 

90 } 

91 ], 

92 api_key="dummy_api_key", 

93 payment_intent_data={"metadata": {"donation_initiation_id": str(donation_initiation_id)}}, 

94 subscription_data=None, 

95 ) 

96 

97 ## Stripe then makes some webhooks requests 

98 

99 # evt_1P5EkZIfR5z29g5kRH0e4NVx:customer.created 

100 fire_stripe_event("evt_1P5EkZIfR5z29g5kRH0e4NVx") 

101 

102 # evt_3P5El3IfR5z29g5k0TLWlfHq:charge.succeeded, captured before we tagged payments with their initiation 

103 event = json.loads(STRIPE_WEBHOOK_EVENTS["evt_3P5El3IfR5z29g5k0TLWlfHq"]) 

104 event["data"]["object"]["metadata"]["donation_initiation_id"] = str(donation_initiation_id) 

105 fire_stripe_event_data(event) 

106 

107 # evt_1P5El5IfR5z29g5kNedLGqCz:checkout.session.completed 

108 fire_stripe_event("evt_1P5El5IfR5z29g5kNedLGqCz") 

109 

110 # evt_3P5El3IfR5z29g5k0tueVWGH:payment_intent.succeeded 

111 fire_stripe_event("evt_3P5El3IfR5z29g5k0tueVWGH") 

112 

113 # evt_3P5El3IfR5z29g5k0mFVJ2V7:payment_intent.created 

114 fire_stripe_event("evt_3P5El3IfR5z29g5k0mFVJ2V7") 

115 

116 ## Now finally check everything was added to the DB 

117 with session_scope() as session: 

118 donation = session.execute(select(DonationInitiation)).scalar_one() 

119 assert donation.user_id == user_id 

120 assert donation.amount == 100 

121 assert ( 

122 donation.stripe_checkout_session_id == "cs_test_a12ftevGwzCAa236NeLPq6yRAdMt0V2S1gGjFcxfsY4xT4tiREPvbr5lhG" 

123 ) 

124 assert donation.donation_type == DonationType.one_time 

125 assert donation.source == "test-one-time" 

126 

127 invoice = session.execute(select(Invoice)).scalar_one() 

128 assert invoice.user_id == user_id 

129 assert invoice.amount == 100 

130 assert invoice.stripe_payment_intent_id == "pi_3P5El3IfR5z29g5k0N5TNa7R" 

131 assert invoice.invoice_type == InvoiceType.on_platform 

132 assert invoice.donation_initiation_id == donation.id 

133 assert invoice.donation_type == DonationType.one_time 

134 assert ( 

135 invoice.stripe_receipt_url 

136 == "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xS0V6QnlJZlI1ejI5ZzVrKIqF7LAGMgbtNxpJulk6LBaePNy_2Q2RzXJsbk7t1jLwK26AQlG05P-4EPhG7AIIcqsQLgC09iDJ2srs" 

137 ) 

138 

139 # check they get a badge 

140 update_badges(empty_pb2.Empty()) 

141 with session_scope() as session: 

142 assert ( 

143 session.execute( 

144 select(UserBadge.user_id).where(UserBadge.user_id == user_id, UserBadge.badge_id == "donor") 

145 ).scalar_one() 

146 == user_id 

147 ) 

148 

149 

150def test_monthly_donation_flow(db, stripe_config): 

151 user, token = generate_user() 

152 user_email = user.email 

153 user_id = user.id 

154 

155 config.STRIPE_RECURRING_PRODUCT_ID = "price_1IRoHdE5kUmYuPWz9tX8UpRv" 

156 

157 ## User first makes a req to Donations.InitiateDonation 

158 with donations_session(token) as donations: 

159 with patch("couchers.servicers.donations.stripe") as mock: 

160 mock.Customer.create.return_value = type("__MockCustomer", (), {"id": "cus_Pv4w8dxBpTVUsQ"}) 

161 mock.checkout.Session.create.return_value = type("__MockCheckoutSession", (), RECURRING_STRIPE_SESSION) 

162 

163 res = donations.InitiateDonation( 

164 donations_pb2.InitiateDonationReq( 

165 amount=25, 

166 frequency=donations_pb2.DONATION_FREQUENCY_MONTHLY, 

167 source="test-monthly", 

168 ) 

169 ) 

170 

171 mock.Customer.create.assert_called_once_with( 

172 email=user_email, metadata={"user_id": user_id}, api_key="dummy_api_key" 

173 ) 

174 

175 with session_scope() as session: 

176 donation_initiation_id = session.execute(select(DonationInitiation.id)).scalar_one() 

177 

178 mock.checkout.Session.create.assert_called_once_with( 

179 client_reference_id=str(user_id), 

180 customer="cus_Pv4w8dxBpTVUsQ", 

181 submit_type=None, 

182 success_url="http://localhost:3000/donate?success=true", 

183 cancel_url="http://localhost:3000/donate?cancelled=true", 

184 payment_method_types=["card"], 

185 mode="subscription", 

186 line_items=[ 

187 { 

188 "price": "price_1IRoHdE5kUmYuPWz9tX8UpRv", 

189 "quantity": 25, 

190 } 

191 ], 

192 api_key="dummy_api_key", 

193 payment_intent_data=None, 

194 subscription_data={"metadata": {"donation_initiation_id": str(donation_initiation_id)}}, 

195 ) 

196 

197 ## Stripe then makes some webhooks requests 

198 

199 # evt_1P5EmWIfR5z29g5kdOMc8bxr: customer.created 

200 fire_stripe_event("evt_1P5EmWIfR5z29g5kdOMc8bxr") 

201 

202 # evt_3P5EmzIfR5z29g5k0bA1H9Vg: charge.succeeded 

203 with mock_subscription_invoice({"donation_initiation_id": str(donation_initiation_id)}) as mock_retrieve: 

204 fire_stripe_event("evt_3P5EmzIfR5z29g5k0bA1H9Vg") 

205 mock_retrieve.assert_called_once_with("in_1P5EmzIfR5z29g5kNwA5fIXq", api_key="dummy_api_key") 

206 

207 # evt_1P5En1IfR5z29g5k89Az23Na: payment_method.attached 

208 fire_stripe_event("evt_1P5En1IfR5z29g5k89Az23Na") 

209 

210 # evt_1P5En1IfR5z29g5kh279xFFB: customer.updated 

211 fire_stripe_event("evt_1P5En1IfR5z29g5kh279xFFB") 

212 

213 # evt_1P5En2IfR5z29g5khvLimtc3: customer.subscription.created 

214 fire_stripe_event("evt_1P5En2IfR5z29g5khvLimtc3") 

215 

216 # evt_1P5En2IfR5z29g5kQ3f7d9C6: customer.subscription.updated 

217 fire_stripe_event("evt_1P5En2IfR5z29g5kQ3f7d9C6") 

218 

219 # evt_3P5EmzIfR5z29g5k0taFsMsl: payment_intent.succeeded 

220 fire_stripe_event("evt_3P5EmzIfR5z29g5k0taFsMsl") 

221 

222 # evt_3P5EmzIfR5z29g5k0bxxQl9f: payment_intent.created 

223 fire_stripe_event("evt_3P5EmzIfR5z29g5k0bxxQl9f") 

224 

225 # evt_1P5En2IfR5z29g5kQZBnH8bR: invoice.created 

226 fire_stripe_event("evt_1P5En2IfR5z29g5kQZBnH8bR") 

227 

228 # evt_1P5En2IfR5z29g5kGrG7cxm7: invoice.finalized 

229 fire_stripe_event("evt_1P5En2IfR5z29g5kGrG7cxm7") 

230 

231 # evt_1P5En3IfR5z29g5kRKYnPpgc: invoice.updated 

232 fire_stripe_event("evt_1P5En3IfR5z29g5kRKYnPpgc") 

233 

234 # evt_1P5En3IfR5z29g5kXDrXUkQa: invoice.paid 

235 fire_stripe_event("evt_1P5En3IfR5z29g5kXDrXUkQa") 

236 

237 # evt_1P5En3IfR5z29g5k3ElqoMso: invoice.payment_succeeded 

238 fire_stripe_event("evt_1P5En3IfR5z29g5k3ElqoMso") 

239 

240 # evt_1P5En3IfR5z29g5kOoaABPf4: checkout.session.completed 

241 fire_stripe_event("evt_1P5En3IfR5z29g5kOoaABPf4") 

242 

243 ## Now finally check everything was added to the DB 

244 with session_scope() as session: 

245 donation = session.execute(select(DonationInitiation)).scalar_one() 

246 assert donation.user_id == user_id 

247 assert donation.amount == 25 

248 assert ( 

249 donation.stripe_checkout_session_id == "cs_test_a1JoMu1FbksL058ob6T6AC1byYR2DCXVRwi0ybLSZKwINYe868OQr25qaC" 

250 ) 

251 assert donation.donation_type == DonationType.monthly 

252 assert donation.source == "test-monthly" 

253 

254 invoice = session.execute(select(Invoice)).scalar_one() 

255 assert invoice.user_id == user_id 

256 assert invoice.amount == 25 

257 assert invoice.stripe_payment_intent_id == "pi_3P5EmzIfR5z29g5k0uVvI3kX" 

258 assert invoice.invoice_type == InvoiceType.on_platform 

259 assert invoice.donation_initiation_id == donation.id 

260 assert invoice.donation_type == DonationType.monthly 

261 assert ( 

262 invoice.stripe_receipt_url 

263 == "https://pay.stripe.com/receipts/invoices/CAcaFwoVYWNjdF8xS0V6QnlJZlI1ejI5ZzVrKIOG7LAGMgYTBIebo2c6LBYFs4BgdV7T4S5nHXQyHt4uh5azZ3_ss_S2wi27m52wbg4yQAoirZ9eBhbH?s=ap" 

264 ) 

265 

266 # check they get a badge 

267 update_badges(empty_pb2.Empty()) 

268 with session_scope() as session: 

269 assert ( 

270 session.execute( 

271 select(UserBadge.user_id).where(UserBadge.user_id == user_id, UserBadge.badge_id == "donor") 

272 ).scalar_one() 

273 == user_id 

274 ) 

275 

276 

277def test_yearly_donation_flow(db, stripe_config): 

278 user, token = generate_user() 

279 user_id = user.id 

280 

281 with donations_session(token) as donations: 

282 with patch("couchers.servicers.donations.stripe") as mock: 

283 mock.Customer.create.return_value = type("__MockCustomer", (), {"id": "cus_Pv4w8dxBpTVUsQ"}) 

284 mock.checkout.Session.create.return_value = type("__MockCheckoutSession", (), RECURRING_STRIPE_SESSION) 

285 

286 donations.InitiateDonation( 

287 donations_pb2.InitiateDonationReq( 

288 amount=250, 

289 frequency=donations_pb2.DONATION_FREQUENCY_YEARLY, 

290 source="test-yearly", 

291 ) 

292 ) 

293 

294 with session_scope() as session: 

295 donation_initiation_id = session.execute(select(DonationInitiation.id)).scalar_one() 

296 

297 mock.checkout.Session.create.assert_called_once_with( 

298 client_reference_id=str(user_id), 

299 customer="cus_Pv4w8dxBpTVUsQ", 

300 submit_type=None, 

301 success_url="http://localhost:3000/donate?success=true", 

302 cancel_url="http://localhost:3000/donate?cancelled=true", 

303 payment_method_types=["card"], 

304 mode="subscription", 

305 line_items=[ 

306 { 

307 "price": "price_1UFQSGIfR5z29g5koIy21lYR", 

308 "quantity": 250, 

309 } 

310 ], 

311 api_key="dummy_api_key", 

312 payment_intent_data=None, 

313 subscription_data={"metadata": {"donation_initiation_id": str(donation_initiation_id)}}, 

314 ) 

315 

316 with session_scope() as session: 

317 donation = session.execute(select(DonationInitiation)).scalar_one() 

318 assert donation.user_id == user_id 

319 assert donation.amount == 250 

320 assert donation.donation_type == DonationType.yearly 

321 assert donation.source == "test-yearly" 

322 

323 

324def test_unspecified_donation_frequency(db, stripe_config): 

325 _, token = generate_user() 

326 

327 with donations_session(token) as donations: 

328 with pytest.raises(grpc.RpcError) as e: 

329 donations.InitiateDonation(donations_pb2.InitiateDonationReq(amount=100)) 

330 assert e.value.code() == grpc.StatusCode.INVALID_ARGUMENT 

331 assert e.value.details() == "Invalid donation frequency." 

332 

333 

334def test_unknown_donation_frequency(db, stripe_config): 

335 _, token = generate_user() 

336 

337 with donations_session(token) as donations: 

338 with pytest.raises(grpc.RpcError) as e: 

339 donations.InitiateDonation( 

340 donations_pb2.InitiateDonationReq(amount=100, frequency=donations_pb2.DonationFrequency.ValueType(42)) 

341 ) 

342 assert e.value.code() == grpc.StatusCode.INVALID_ARGUMENT 

343 assert e.value.details() == "Invalid donation frequency." 

344 

345 

346def test_customer_portal_url(db, stripe_config): 

347 user, token = generate_user() 

348 user_email = user.email 

349 user_id = user.id 

350 

351 ## User first makes a req to Donations.InitiateDonation 

352 with donations_session(token) as donations: 

353 with patch("couchers.servicers.donations.stripe") as mock: 

354 mock.Customer.create.return_value = type("__MockCustomer", (), {"id": "cus_Pv4uq0gT0rDZWN"}) 

355 mock.billing_portal.Session.create.return_value = type( 

356 "__MockBillingPortalSession", (), {"url": "https://stripe.com.invalid/subman"} 

357 ) 

358 

359 res = donations.GetDonationPortalLink(empty_pb2.Empty()) 

360 assert res.stripe_portal_url == "https://stripe.com.invalid/subman" 

361 

362 res = donations.GetDonationPortalLink(empty_pb2.Empty()) 

363 assert res.stripe_portal_url == "https://stripe.com.invalid/subman" 

364 

365 mock.Customer.create.assert_called_once_with( 

366 email=user_email, metadata={"user_id": user_id}, api_key="dummy_api_key" 

367 ) 

368 

369 

370def test_merch_invoice_flow(db, stripe_config): 

371 """Test that external shop purchases (e.g., from merch shop) grant swagster badge but don't update last_donated""" 

372 user, token = generate_user(email="test@couchers.org.invalid", last_donated=None) 

373 

374 ## Stripe sends a charge.succeeded webhook for a merch purchase 

375 fire_stripe_event("evt_merch_charge_succeeded") 

376 

377 ## Check that no invoice was created, last_donated was not updated, but swagster badge was granted 

378 with session_scope() as session: 

379 assert not session.execute(select(Invoice.id)).scalar_one_or_none() 

380 assert session.execute(select(User.last_donated)).scalar_one() is None 

381 # Check that swagster badge was granted 

382 badge = session.execute( 

383 select(UserBadge).where(UserBadge.user_id == user.id, UserBadge.badge_id == "swagster") 

384 ).scalar_one_or_none() 

385 assert badge is not None 

386 

387 

388def test_merch_invoice_flow_nonexistent_user(db, stripe_config): 

389 """Test that external shop purchases for non-existent users don't error and don't grant badges""" 

390 user, _ = generate_user(last_donated=None) 

391 

392 ## Stripe sends a charge.succeeded webhook for a merch purchase with a non-matching email 

393 fire_stripe_event("evt_merch_charge_succeeded") 

394 

395 ## Check that no invoice was created, last_donated was not updated, and no badge was granted 

396 with session_scope() as session: 

397 assert not session.execute(select(Invoice.id)).scalar_one_or_none() 

398 assert session.execute(select(User.last_donated)).scalar_one() is None 

399 # Check that no swagster badge was granted 

400 badge_count = session.execute(select(UserBadge).where(UserBadge.badge_id == "swagster")).all() 

401 assert len(badge_count) == 0 

402 

403 

404def test_slack_notification_on_merch_purchase(db, stripe_config): 

405 """Test that a Slack notification is sent when a merch purchase is made by a known user.""" 

406 user, _ = generate_user(email="test@couchers.org.invalid", last_donated=None) 

407 

408 with patch("couchers.servicers.donations.send_slack_message") as mock_slack: 

409 fire_stripe_event("evt_merch_charge_succeeded") 

410 mock_slack.assert_called_once() 

411 call_args = mock_slack.call_args[0] 

412 assert call_args[0] == config.get("SLACK_MERCH_CHANNEL", "merch") 

413 assert "$50" in call_args[1] 

414 assert "Merch purchase" in call_args[1] 

415 assert user.name in call_args[1] 

416 

417 

418def test_slack_notification_on_merch_purchase_unknown_user(db, stripe_config): 

419 """Test that a Slack notification is sent with email when merch purchase is by an unknown user.""" 

420 generate_user(last_donated=None) 

421 

422 with patch("couchers.servicers.donations.send_slack_message") as mock_slack: 

423 fire_stripe_event("evt_merch_charge_succeeded") 

424 mock_slack.assert_called_once() 

425 call_args = mock_slack.call_args[0] 

426 assert call_args[0] == config.get("SLACK_MERCH_CHANNEL", "merch") 

427 assert "$50" in call_args[1] 

428 assert "Merch purchase" in call_args[1] 

429 assert "test@couchers.org.invalid" in call_args[1] 

430 

431 

432def test_merch_purchase_with_customer_email_metadata(db, stripe_config): 

433 """Test that a customer_email in the metadata takes precedence over the emails on the charge.""" 

434 user, _ = generate_user(email="test@couchers.org.invalid", last_donated=None) 

435 

436 event = json.loads(STRIPE_WEBHOOK_EVENTS["evt_merch_charge_succeeded"]) 

437 event["data"]["object"]["metadata"]["customer_email"] = "test@couchers.org.invalid" 

438 event["data"]["object"]["billing_details"]["email"] = "someone.else@couchers.org.invalid" 

439 event["data"]["object"]["receipt_email"] = "someone.else@couchers.org.invalid" 

440 

441 fire_stripe_event_data(event) 

442 

443 with session_scope() as session: 

444 badge = session.execute( 

445 select(UserBadge).where(UserBadge.user_id == user.id, UserBadge.badge_id == "swagster") 

446 ).scalar_one_or_none() 

447 assert badge is not None 

448 

449 

450def test_merch_purchase_without_billing_email(db, stripe_config): 

451 """Test that a merch charge with no billing email doesn't error and doesn't grant badges, even if the receipt email 

452 matches a user.""" 

453 generate_user(email="test@couchers.org.invalid", last_donated=None) 

454 

455 event = json.loads(STRIPE_WEBHOOK_EVENTS["evt_merch_charge_succeeded"]) 

456 event["data"]["object"]["billing_details"]["email"] = None 

457 event["data"]["object"]["receipt_email"] = "test@couchers.org.invalid" 

458 

459 with patch("couchers.servicers.donations.send_slack_message") as mock_slack: 

460 fire_stripe_event_data(event) 

461 assert "unknown email" in mock_slack.call_args[0][1] 

462 

463 with session_scope() as session: 

464 assert not session.execute(select(UserBadge).where(UserBadge.badge_id == "swagster")).all() 

465 

466 

467def test_slack_notification_on_one_time_donation(db, stripe_config): 

468 """Test that a Slack notification is sent when a one-time donation is received.""" 

469 user, token = generate_user() 

470 

471 # Initiate a one-time donation 

472 with donations_session(token) as donations: 

473 with patch("couchers.servicers.donations.stripe") as mock: 

474 mock.Customer.create.return_value = type("__MockCustomer", (), {"id": "cus_Pv4uq0gT0rDZWN"}) 

475 mock.checkout.Session.create.return_value = type("__MockCheckoutSession", (), one_time_STRIPE_SESSION) 

476 donations.InitiateDonation( 

477 donations_pb2.InitiateDonationReq(amount=100, frequency=donations_pb2.DONATION_FREQUENCY_ONE_TIME) 

478 ) 

479 

480 # Fire the charge.succeeded webhook and check Slack message 

481 with patch("couchers.servicers.donations.send_slack_message") as mock_slack: 

482 # Captured Stripe test-mode event: charge.succeeded for one-time $100 donation 

483 fire_stripe_event("evt_3P5El3IfR5z29g5k0TLWlfHq") 

484 mock_slack.assert_called_once() 

485 call_args = mock_slack.call_args[0][1] 

486 assert "$100" in call_args 

487 assert "(one-time)" in call_args 

488 assert user.name in call_args 

489 

490 

491def test_slack_notification_on_monthly_donation(db, stripe_config): 

492 """Test that a Slack notification is sent when a monthly donation is received.""" 

493 user, token = generate_user() 

494 

495 config.STRIPE_RECURRING_PRODUCT_ID = "price_1IRoHdE5kUmYuPWz9tX8UpRv" 

496 

497 # Initiate a recurring donation 

498 with donations_session(token) as donations: 

499 with patch("couchers.servicers.donations.stripe") as mock: 

500 mock.Customer.create.return_value = type("__MockCustomer", (), {"id": "cus_Pv4w8dxBpTVUsQ"}) 

501 mock.checkout.Session.create.return_value = type("__MockCheckoutSession", (), RECURRING_STRIPE_SESSION) 

502 donations.InitiateDonation( 

503 donations_pb2.InitiateDonationReq(amount=25, frequency=donations_pb2.DONATION_FREQUENCY_MONTHLY) 

504 ) 

505 

506 # Fire the charge.succeeded webhook and check Slack message 

507 with patch("couchers.servicers.donations.send_slack_message") as mock_slack: 

508 # Captured Stripe test-mode event: charge.succeeded for recurring $25 donation 

509 with mock_subscription_invoice({}): 

510 fire_stripe_event("evt_3P5EmzIfR5z29g5k0bA1H9Vg") 

511 mock_slack.assert_called_once() 

512 call_args = mock_slack.call_args[0][1] 

513 assert "$25" in call_args 

514 assert "(recurring)" in call_args 

515 assert user.name in call_args 

516 

517 

518def test_revenue_metric_on_donation(db, stripe_config): 

519 """A successful donation charge records revenue in cents under the 'donation' type.""" 

520 user, token = generate_user() 

521 

522 with donations_session(token) as donations: 

523 with patch("couchers.servicers.donations.stripe") as mock: 

524 mock.Customer.create.return_value = type("__MockCustomer", (), {"id": "cus_Pv4uq0gT0rDZWN"}) 

525 mock.checkout.Session.create.return_value = type("__MockCheckoutSession", (), one_time_STRIPE_SESSION) 

526 donations.InitiateDonation( 

527 donations_pb2.InitiateDonationReq(amount=100, frequency=donations_pb2.DONATION_FREQUENCY_ONE_TIME) 

528 ) 

529 

530 with patch("couchers.servicers.donations.observe_revenue") as mock_observe_revenue: 

531 # Captured Stripe test-mode event: charge.succeeded for one-time $100 donation 

532 fire_stripe_event("evt_3P5El3IfR5z29g5k0TLWlfHq") 

533 mock_observe_revenue.assert_called_once_with("donation", 10000) 

534 

535 

536def test_revenue_metric_on_merch(db, stripe_config): 

537 """A successful merch charge records revenue in cents under the 'merch' type.""" 

538 generate_user(email="test@couchers.org.invalid", last_donated=None) 

539 

540 with patch("couchers.servicers.donations.observe_revenue") as mock_observe_revenue: 

541 # Captured Stripe test-mode event: charge.succeeded for a $50 merch purchase 

542 fire_stripe_event("evt_merch_charge_succeeded") 

543 mock_observe_revenue.assert_called_once_with("merch", 5000) 

544 

545 

546def test_duplicate_charge_webhook(db, stripe_config): 

547 """Stripe may deliver the same charge.succeeded more than once, and it should only be recorded once.""" 

548 generate_user(stripe_customer_id="cus_Pv4uq0gT0rDZWN") 

549 

550 with patch("couchers.servicers.donations.send_slack_message") as mock_slack: 

551 with patch("couchers.servicers.donations.observe_revenue") as mock_observe_revenue: 

552 fire_stripe_event("evt_3P5El3IfR5z29g5k0TLWlfHq") 

553 fire_stripe_event("evt_3P5El3IfR5z29g5k0TLWlfHq") 

554 mock_slack.assert_called_once() 

555 mock_observe_revenue.assert_called_once() 

556 

557 with session_scope() as session: 

558 invoice = session.execute(select(Invoice)).scalar_one() 

559 assert invoice.stripe_payment_intent_id == "pi_3P5El3IfR5z29g5k0N5TNa7R" 

560 

561 

562def test_untagged_one_time_donation(db, stripe_config): 

563 """One-time charges from checkouts started before we tagged them still record their frequency.""" 

564 generate_user(stripe_customer_id="cus_Pv4uq0gT0rDZWN") 

565 

566 fire_stripe_event("evt_3P5El3IfR5z29g5k0TLWlfHq") 

567 

568 with session_scope() as session: 

569 invoice = session.execute(select(Invoice)).scalar_one() 

570 assert invoice.donation_initiation_id is None 

571 assert invoice.donation_type == DonationType.one_time 

572 

573 

574def test_untagged_recurring_donation(db, stripe_config): 

575 """Renewals of subscriptions started before we tagged them are recorded without an initiation or frequency.""" 

576 generate_user(stripe_customer_id="cus_Pv4w8dxBpTVUsQ") 

577 

578 with mock_subscription_invoice({}): 

579 fire_stripe_event("evt_3P5EmzIfR5z29g5k0bA1H9Vg") 

580 

581 with session_scope() as session: 

582 invoice = session.execute(select(Invoice)).scalar_one() 

583 assert invoice.donation_initiation_id is None 

584 assert invoice.donation_type is None 

585 

586 

587def test_recurring_donation_renewal(db, stripe_config): 

588 """Every renewal of a subscription is linked back to the initiation that started it.""" 

589 user, token = generate_user() 

590 

591 with donations_session(token) as donations: 

592 with patch("couchers.servicers.donations.stripe") as mock: 

593 mock.Customer.create.return_value = type("__MockCustomer", (), {"id": "cus_Pv4w8dxBpTVUsQ"}) 

594 mock.checkout.Session.create.return_value = type("__MockCheckoutSession", (), RECURRING_STRIPE_SESSION) 

595 donations.InitiateDonation( 

596 donations_pb2.InitiateDonationReq(amount=25, frequency=donations_pb2.DONATION_FREQUENCY_YEARLY) 

597 ) 

598 

599 with session_scope() as session: 

600 donation_initiation_id = session.execute(select(DonationInitiation.id)).scalar_one() 

601 

602 event = json.loads(STRIPE_WEBHOOK_EVENTS["evt_3P5EmzIfR5z29g5k0bA1H9Vg"]) 

603 with mock_subscription_invoice({"donation_initiation_id": str(donation_initiation_id)}): 

604 fire_stripe_event_data(event) 

605 event["data"]["object"]["payment_intent"] = "pi_renewal" 

606 fire_stripe_event_data(event) 

607 

608 with session_scope() as session: 

609 invoices = session.execute(select(Invoice).order_by(Invoice.id)).scalars().all() 

610 assert [invoice.stripe_payment_intent_id for invoice in invoices] == [ 

611 "pi_3P5EmzIfR5z29g5k0uVvI3kX", 

612 "pi_renewal", 

613 ] 

614 for invoice in invoices: 

615 assert invoice.donation_initiation_id == donation_initiation_id 

616 assert invoice.donation_type == DonationType.yearly 

617 

618 

619def mock_subscription_invoice(subscription_metadata): 

620 return patch.object( 

621 stripe.Invoice, 

622 "retrieve", 

623 return_value=stripe.Invoice.construct_from( 

624 { 

625 "id": "in_1P5EmzIfR5z29g5kNwA5fIXq", 

626 "object": "invoice", 

627 "parent": {"subscription_details": {"metadata": subscription_metadata}}, 

628 }, 

629 "dummy_api_key", 

630 ), 

631 ) 

632 

633 

634def fire_stripe_event(event_id): 

635 fire_stripe_event_data(json.loads(STRIPE_WEBHOOK_EVENTS[event_id])) 

636 

637 

638def fire_stripe_event_data(event): 

639 payload = json.dumps(event).encode("utf-8") 

640 timestamp = int(time.time()) 

641 signature = hmac.new(b"dummy_webhook_secret", f"{timestamp}.".encode() + payload, hashlib.sha256).hexdigest() 

642 

643 with real_stripe_session() as api: 

644 api.Webhook( 

645 httpbody_pb2.HttpBody(content_type="application/json", data=payload), 

646 metadata=(("stripe-signature", f"t={timestamp},v1={signature}"),), 

647 ) 

648 

649 

650STRIPE_WEBHOOK_EVENTS = { 

651 "evt_1P5EkZIfR5z29g5kRH0e4NVx": '{"id": "evt_1P5EkZIfR5z29g5kRH0e4NVx", "object": "event", "api_version": "2024-04-10", "created": 1713046123, "data": {"object": {"id": "cus_Pv4uq0gT0rDZWN", "object": "customer", "address": null, "balance": 0, "created": 1713046123, "currency": null, "default_source": null, "delinquent": false, "description": null, "discount": null, "email": "aapeli@couchers.org", "invoice_prefix": "1D722509", "invoice_settings": {"custom_fields": null, "default_payment_method": null, "footer": null, "rendering_options": null}, "livemode": false, "metadata": {"user_id": "1"}, "name": null, "next_invoice_sequence": 1, "phone": null, "preferred_locales": [], "shipping": null, "tax_exempt": "none", "test_clock": null}}, "livemode": false, "pending_webhooks": 2, "request": {"id": "req_fmlaiE4CYTgEof", "idempotency_key": "8e902937-af49-4880-b3fa-6ccf88bc38ee"}, "type": "customer.created"}', 

652 "evt_1P5El5IfR5z29g5kNedLGqCz": '{"id": "evt_1P5El5IfR5z29g5kNedLGqCz", "object": "event", "api_version": "2024-04-10", "created": 1713046154, "data": {"object": {"id": "cs_test_a12ftevGwzCAa236NeLPq6yRAdMt0V2S1gGjFcxfsY4xT4tiREPvbr5lhG", "object": "checkout.session", "after_expiration": null, "allow_promotion_codes": null, "amount_subtotal": 10000, "amount_total": 10000, "automatic_tax": {"enabled": false, "liability": null, "status": null}, "billing_address_collection": null, "cancel_url": "http://localhost:3000/donate?cancelled=true", "client_reference_id": "1", "client_secret": null, "consent": null, "consent_collection": null, "created": 1713046124, "currency": "usd", "currency_conversion": null, "custom_fields": [], "custom_text": {"after_submit": null, "shipping_address": null, "submit": null, "terms_of_service_acceptance": null}, "customer": "cus_Pv4uq0gT0rDZWN", "customer_creation": null, "customer_details": {"address": {"city": null, "country": "US", "line1": null, "line2": null, "postal_code": "10001", "state": null}, "email": "aapeli@couchers.org", "name": "Aapeli Vuorinen", "phone": null, "tax_exempt": "none", "tax_ids": []}, "customer_email": null, "expires_at": 1713132523, "invoice": null, "invoice_creation": {"enabled": false, "invoice_data": {"account_tax_ids": null, "custom_fields": null, "description": null, "footer": null, "issuer": null, "metadata": {}, "rendering_options": null}}, "livemode": false, "locale": null, "metadata": {}, "mode": "payment", "payment_intent": "pi_3P5El3IfR5z29g5k0N5TNa7R", "payment_link": null, "payment_method_collection": "if_required", "payment_method_configuration_details": null, "payment_method_options": {"card": {"request_three_d_secure": "automatic"}}, "payment_method_types": ["card"], "payment_status": "paid", "phone_number_collection": {"enabled": false}, "recovered_from": null, "setup_intent": null, "shipping_address_collection": null, "shipping_cost": null, "shipping_details": null, "shipping_options": [], "status": "complete", "submit_type": "donate", "subscription": null, "success_url": "http://localhost:3000/donate?success=true", "total_details": {"amount_discount": 0, "amount_shipping": 0, "amount_tax": 0}, "ui_mode": "hosted", "url": null}}, "livemode": false, "pending_webhooks": 3, "request": {"id": null, "idempotency_key": null}, "type": "checkout.session.completed"}', 

653 "evt_1P5EmWIfR5z29g5kdOMc8bxr": '{"id": "evt_1P5EmWIfR5z29g5kdOMc8bxr", "object": "event", "api_version": "2024-04-10", "created": 1713046244, "data": {"object": {"id": "cus_Pv4w8dxBpTVUsQ", "object": "customer", "address": null, "balance": 0, "created": 1713046244, "currency": null, "default_source": null, "delinquent": false, "description": null, "discount": null, "email": "aapeli@couchers.org", "invoice_prefix": "D86E702F", "invoice_settings": {"custom_fields": null, "default_payment_method": null, "footer": null, "rendering_options": null}, "livemode": false, "metadata": {"user_id": "1"}, "name": null, "next_invoice_sequence": 1, "phone": null, "preferred_locales": [], "shipping": null, "tax_exempt": "none", "test_clock": null}}, "livemode": false, "pending_webhooks": 2, "request": {"id": "req_3k3Wk50uSmpv6d", "idempotency_key": "a6fc3ba9-0dfa-4f44-a556-4150e6c54922"}, "type": "customer.created"}', 

654 "evt_1P5En1IfR5z29g5k89Az23Na": '{"id": "evt_1P5En1IfR5z29g5k89Az23Na", "object": "event", "api_version": "2024-04-10", "created": 1713046274, "data": {"object": {"id": "pm_1P5EmyIfR5z29g5kAIZoJcSv", "object": "payment_method", "billing_details": {"address": {"city": null, "country": "US", "line1": null, "line2": null, "postal_code": "10001", "state": null}, "email": "aapeli@couchers.org", "name": "Aapeli Vuorinen", "phone": null}, "card": {"brand": "visa", "checks": {"address_line1_check": null, "address_postal_code_check": "pass", "cvc_check": "pass"}, "country": "US", "display_brand": "visa", "exp_month": 12, "exp_year": 2050, "fingerprint": "2uVHwVtZ157kRjpi", "funding": "credit", "generated_from": null, "last4": "4242", "networks": {"available": ["visa"], "preferred": null}, "three_d_secure_usage": {"supported": true}, "wallet": null}, "created": 1713046272, "customer": "cus_Pv4w8dxBpTVUsQ", "livemode": false, "metadata": {}, "type": "card"}}, "livemode": false, "pending_webhooks": 2, "request": {"id": "req_x1PqgmCHBOPD0i", "idempotency_key": "44ec8acd-be18-4de0-af2e-715760e96725"}, "type": "payment_method.attached"}', 

655 "evt_1P5En1IfR5z29g5kh279xFFB": '{"id": "evt_1P5En1IfR5z29g5kh279xFFB", "object": "event", "api_version": "2024-04-10", "created": 1713046273, "data": {"object": {"id": "cus_Pv4w8dxBpTVUsQ", "object": "customer", "address": null, "balance": 0, "created": 1713046244, "currency": "usd", "default_source": null, "delinquent": false, "description": null, "discount": null, "email": "aapeli@couchers.org", "invoice_prefix": "D86E702F", "invoice_settings": {"custom_fields": null, "default_payment_method": null, "footer": null, "rendering_options": null}, "livemode": false, "metadata": {"user_id": "1"}, "name": null, "next_invoice_sequence": 2, "phone": null, "preferred_locales": [], "shipping": null, "tax_exempt": "none", "test_clock": null}, "previous_attributes": {"currency": null}}, "livemode": false, "pending_webhooks": 2, "request": {"id": "req_x1PqgmCHBOPD0i", "idempotency_key": "44ec8acd-be18-4de0-af2e-715760e96725"}, "type": "customer.updated"}', 

656 "evt_1P5En2IfR5z29g5kGrG7cxm7": '{"id": "evt_1P5En2IfR5z29g5kGrG7cxm7", "object": "event", "api_version": "2024-04-10", "created": 1713046273, "data": {"object": {"id": "in_1P5EmzIfR5z29g5kNwA5fIXq", "object": "invoice", "account_country": "US", "account_name": "Couchers, Inc.", "account_tax_ids": null, "amount_due": 2500, "amount_paid": 0, "amount_remaining": 2500, "amount_shipping": 0, "application": null, "application_fee_amount": null, "attempt_count": 0, "attempted": false, "auto_advance": false, "automatic_tax": {"enabled": false, "liability": null, "status": null}, "billing_reason": "subscription_create", "charge": null, "collection_method": "charge_automatically", "created": 1713046273, "currency": "usd", "custom_fields": null, "customer": "cus_Pv4w8dxBpTVUsQ", "customer_address": null, "customer_email": "aapeli@couchers.org", "customer_name": null, "customer_phone": null, "customer_shipping": null, "customer_tax_exempt": "none", "customer_tax_ids": [], "default_payment_method": null, "default_source": null, "default_tax_rates": [], "description": null, "discount": null, "discounts": [], "due_date": null, "effective_at": 1713046273, "ending_balance": 0, "footer": null, "from_invoice": null, "hosted_invoice_url": "https://invoice.stripe.com/i/acct_1KEzByIfR5z29g5k/test_YWNjdF8xS0V6QnlJZlI1ejI5ZzVrLF9QdjR3dzFNVDRGcHo4ZTI1Z05tMXA5WldlMld2VGE2LDEwMzU4NzA3Ng0200xNecenik?s=ap", "invoice_pdf": "https://pay.stripe.com/invoice/acct_1KEzByIfR5z29g5k/test_YWNjdF8xS0V6QnlJZlI1ejI5ZzVrLF9QdjR3dzFNVDRGcHo4ZTI1Z05tMXA5WldlMld2VGE2LDEwMzU4NzA3Ng0200xNecenik/pdf?s=ap", "issuer": {"type": "self"}, "last_finalization_error": null, "latest_revision": null, "lines": {"object": "list", "data": [{"id": "il_1P5EmzIfR5z29g5khRFJxpUq", "object": "line_item", "amount": 2500, "amount_excluding_tax": 2500, "currency": "usd", "description": "25 \u00d7 Couchers financial supporter (Tier 2 at $1.00 / month)", "discount_amounts": [], "discountable": true, "discounts": [], "invoice": "in_1P5EmzIfR5z29g5kNwA5fIXq", "livemode": false, "metadata": {}, "period": {"end": 1715638273, "start": 1713046273}, "plan": {"id": "price_1KIbmbIfR5z29g5kFWPEUnC6", "object": "plan", "active": true, "aggregate_usage": null, "amount": null, "amount_decimal": null, "billing_scheme": "tiered", "created": 1642351245, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_KyYuo4dO67NKtG", "tiers_mode": "volume", "transform_usage": null, "trial_period_days": null, "usage_type": "licensed"}, "price": {"id": "price_1KIbmbIfR5z29g5kFWPEUnC6", "object": "price", "active": true, "billing_scheme": "tiered", "created": 1642351245, "currency": "usd", "custom_unit_amount": null, "livemode": false, "lookup_key": null, "metadata": {}, "nickname": null, "product": "prod_KyYuo4dO67NKtG", "recurring": {"aggregate_usage": null, "interval": "month", "interval_count": 1, "trial_period_days": null, "usage_type": "licensed"}, "tax_behavior": "unspecified", "tiers_mode": "volume", "transform_quantity": null, "type": "recurring", "unit_amount": null, "unit_amount_decimal": null}, "proration": false, "proration_details": {"credited_items": null}, "quantity": 25, "subscription": "sub_1P5EmzIfR5z29g5k2nmkX0l3", "subscription_item": "si_Pv4w0QuX2JUBXm", "tax_amounts": [], "tax_rates": [], "type": "subscription", "unit_amount_excluding_tax": "100"}], "has_more": false, "total_count": 1, "url": "/v1/invoices/in_1P5EmzIfR5z29g5kNwA5fIXq/lines"}, "livemode": false, "metadata": {}, "next_payment_attempt": null, "number": "D86E702F-0001", "on_behalf_of": null, "paid": false, "paid_out_of_band": false, "payment_intent": "pi_3P5EmzIfR5z29g5k0uVvI3kX", "payment_settings": {"default_mandate": null, "payment_method_options": {"acss_debit": null, "bancontact": null, "card": {"request_three_d_secure": "automatic"}, "customer_balance": null, "konbini": null, "sepa_debit": null, "us_bank_account": null}, "payment_method_types": null}, "period_end": 1713046273, "period_start": 1713046273, "post_payment_credit_notes_amount": 0, "pre_payment_credit_notes_amount": 0, "quote": null, "receipt_number": null, "rendering": null, "shipping_cost": null, "shipping_details": null, "starting_balance": 0, "statement_descriptor": null, "status": "open", "status_transitions": {"finalized_at": 1713046273, "marked_uncollectible_at": null, "paid_at": null, "voided_at": null}, "subscription": "sub_1P5EmzIfR5z29g5k2nmkX0l3", "subscription_details": {"metadata": {}}, "subtotal": 2500, "subtotal_excluding_tax": 2500, "tax": null, "test_clock": null, "total": 2500, "total_discount_amounts": [], "total_excluding_tax": 2500, "total_tax_amounts": [], "transfer_data": null, "webhooks_delivered_at": null}}, "livemode": false, "pending_webhooks": 2, "request": {"id": "req_x1PqgmCHBOPD0i", "idempotency_key": "44ec8acd-be18-4de0-af2e-715760e96725"},"type": "invoice.finalized"}', 

657 "evt_1P5En2IfR5z29g5khvLimtc3": '{"id": "evt_1P5En2IfR5z29g5khvLimtc3", "object": "event", "api_version": "2024-04-10", "created": 1713046273, "data": {"object": {"id": "sub_1P5EmzIfR5z29g5k2nmkX0l3", "object": "subscription", "application": null, "application_fee_percent": null, "automatic_tax": {"enabled": false, "liability": null}, "billing_cycle_anchor": 1713046273, "billing_cycle_anchor_config": null, "billing_thresholds": null, "cancel_at": null, "cancel_at_period_end": false, "canceled_at": null, "cancellation_details": {"comment": null, "feedback": null, "reason": null}, "collection_method": "charge_automatically", "created": 1713046273, "currency": "usd", "current_period_end": 1715638273, "current_period_start": 1713046273, "customer": "cus_Pv4w8dxBpTVUsQ", "days_until_due": null, "default_payment_method": null, "default_source": null, "default_tax_rates": [], "description": null, "discount": null, "discounts": [], "ended_at": null, "invoice_settings": {"account_tax_ids": null, "issuer": {"type": "self"}}, "items": {"object": "list", "data": [{"id": "si_Pv4w0QuX2JUBXm", "object": "subscription_item", "billing_thresholds": null, "created": 1713046273, "discounts": [], "metadata": {}, "plan": {"id": "price_1KIbmbIfR5z29g5kFWPEUnC6", "object": "plan", "active": true, "aggregate_usage": null, "amount": null, "amount_decimal": null, "billing_scheme": "tiered", "created": 1642351245, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_KyYuo4dO67NKtG", "tiers_mode": "volume", "transform_usage": null, "trial_period_days": null, "usage_type": "licensed"}, "price": {"id": "price_1KIbmbIfR5z29g5kFWPEUnC6", "object": "price", "active": true, "billing_scheme": "tiered", "created": 1642351245, "currency": "usd", "custom_unit_amount": null, "livemode": false, "lookup_key": null, "metadata": {}, "nickname": null, "product": "prod_KyYuo4dO67NKtG", "recurring": {"aggregate_usage": null, "interval": "month", "interval_count": 1, "trial_period_days": null, "usage_type": "licensed"}, "tax_behavior": "unspecified", "tiers_mode": "volume", "transform_quantity": null, "type": "recurring", "unit_amount": null, "unit_amount_decimal": null}, "quantity": 25, "subscription": "sub_1P5EmzIfR5z29g5k2nmkX0l3", "tax_rates": []}], "has_more": false, "total_count": 1, "url": "/v1/subscription_items?subscription=sub_1P5EmzIfR5z29g5k2nmkX0l3"}, "latest_invoice": "in_1P5EmzIfR5z29g5kNwA5fIXq", "livemode": false, "metadata": {}, "next_pending_invoice_item_invoice": null, "on_behalf_of": null, "pause_collection": null, "payment_settings": {"payment_method_options": {"acss_debit": null, "bancontact": null, "card": {"network": null, "request_three_d_secure": "automatic"}, "customer_balance": null, "konbini": null, "sepa_debit": null, "us_bank_account": null}, "payment_method_types": null, "save_default_payment_method": "off"}, "pending_invoice_item_interval": null, "pending_setup_intent": null, "pending_update": null, "plan": {"id": "price_1KIbmbIfR5z29g5kFWPEUnC6", "object": "plan", "active": true, "aggregate_usage": null, "amount": null, "amount_decimal": null, "billing_scheme": "tiered", "created": 1642351245, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_KyYuo4dO67NKtG", "tiers_mode": "volume", "transform_usage": null, "trial_period_days": null, "usage_type": "licensed"}, "quantity": 25, "schedule": null, "start_date": 1713046273, "status": "incomplete", "test_clock": null, "transfer_data": null, "trial_end": null, "trial_settings": {"end_behavior": {"missing_payment_method": "create_invoice"}}, "trial_start": null}}, "livemode": false, "pending_webhooks": 2, "request": {"id": "req_x1PqgmCHBOPD0i", "idempotency_key": "44ec8acd-be18-4de0-af2e-715760e96725"}, "type": "customer.subscription.created"}', 

658 "evt_1P5En2IfR5z29g5kQ3f7d9C6": '{"id": "evt_1P5En2IfR5z29g5kQ3f7d9C6", "object": "event", "api_version": "2024-04-10", "created": 1713046275, "data": {"object": {"id": "sub_1P5EmzIfR5z29g5k2nmkX0l3", "object": "subscription", "application": null, "application_fee_percent": null, "automatic_tax": {"enabled": false, "liability": null}, "billing_cycle_anchor": 1713046273, "billing_cycle_anchor_config": null, "billing_thresholds": null, "cancel_at": null, "cancel_at_period_end": false, "canceled_at": null, "cancellation_details": {"comment": null, "feedback": null, "reason": null}, "collection_method": "charge_automatically", "created": 1713046273, "currency": "usd", "current_period_end": 1715638273, "current_period_start": 1713046273, "customer": "cus_Pv4w8dxBpTVUsQ", "days_until_due": null, "default_payment_method": "pm_1P5EmyIfR5z29g5kAIZoJcSv", "default_source": null, "default_tax_rates": [], "description": null, "discount": null, "discounts": [], "ended_at": null, "invoice_settings": {"account_tax_ids": null, "issuer": {"type": "self"}}, "items": {"object": "list", "data": [{"id": "si_Pv4w0QuX2JUBXm", "object": "subscription_item", "billing_thresholds": null, "created": 1713046273, "discounts": [], "metadata": {}, "plan": {"id": "price_1KIbmbIfR5z29g5kFWPEUnC6", "object": "plan", "active": true, "aggregate_usage": null, "amount": null, "amount_decimal": null, "billing_scheme": "tiered", "created": 1642351245, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_KyYuo4dO67NKtG", "tiers_mode": "volume", "transform_usage": null, "trial_period_days": null, "usage_type": "licensed"}, "price": {"id": "price_1KIbmbIfR5z29g5kFWPEUnC6", "object": "price", "active": true, "billing_scheme": "tiered", "created": 1642351245, "currency": "usd", "custom_unit_amount": null, "livemode": false, "lookup_key": null, "metadata": {}, "nickname": null, "product": "prod_KyYuo4dO67NKtG", "recurring": {"aggregate_usage": null, "interval": "month", "interval_count": 1, "trial_period_days": null, "usage_type": "licensed"}, "tax_behavior": "unspecified", "tiers_mode": "volume", "transform_quantity": null, "type": "recurring", "unit_amount": null, "unit_amount_decimal": null}, "quantity": 25, "subscription": "sub_1P5EmzIfR5z29g5k2nmkX0l3", "tax_rates": []}], "has_more": false, "total_count": 1, "url": "/v1/subscription_items?subscription=sub_1P5EmzIfR5z29g5k2nmkX0l3"}, "latest_invoice": "in_1P5EmzIfR5z29g5kNwA5fIXq", "livemode": false, "metadata": {}, "next_pending_invoice_item_invoice": null, "on_behalf_of": null, "pause_collection": null, "payment_settings": {"payment_method_options": {"acss_debit": null, "bancontact": null, "card": {"network": null, "request_three_d_secure": "automatic"}, "customer_balance": null, "konbini": null, "sepa_debit": null, "us_bank_account": null}, "payment_method_types": null, "save_default_payment_method": "off"}, "pending_invoice_item_interval": null, "pending_setup_intent": null, "pending_update": null, "plan": {"id": "price_1KIbmbIfR5z29g5kFWPEUnC6", "object": "plan", "active": true, "aggregate_usage": null, "amount": null, "amount_decimal": null, "billing_scheme": "tiered", "created": 1642351245, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_KyYuo4dO67NKtG", "tiers_mode": "volume", "transform_usage": null, "trial_period_days": null, "usage_type": "licensed"}, "quantity": 25, "schedule": null, "start_date": 1713046273, "status": "active", "test_clock": null, "transfer_data": null, "trial_end": null, "trial_settings": {"end_behavior": {"missing_payment_method": "create_invoice"}}, "trial_start": null}, "previous_attributes": {"default_payment_method": null, "status": "incomplete"}}, "livemode": false, "pending_webhooks": 2, "request": {"id": "req_x1PqgmCHBOPD0i", "idempotency_key": "44ec8acd-be18-4de0-af2e-715760e96725"}, "type": "customer.subscription.updated"}', 

659 "evt_1P5En2IfR5z29g5kQZBnH8bR": '{"id": "evt_1P5En2IfR5z29g5kQZBnH8bR", "object": "event", "api_version": "2024-04-10", "created": 1713046273, "data": {"object": {"id": "in_1P5EmzIfR5z29g5kNwA5fIXq", "object": "invoice", "account_country": "US", "account_name": "Couchers, Inc.", "account_tax_ids": null, "amount_due": 2500, "amount_paid": 0, "amount_remaining": 2500, "amount_shipping": 0, "application": null, "application_fee_amount": null, "attempt_count": 0, "attempted": false, "auto_advance": false, "automatic_tax": {"enabled": false, "liability": null, "status": null}, "billing_reason": "subscription_create", "charge": null, "collection_method": "charge_automatically", "created": 1713046273, "currency": "usd", "custom_fields": null, "customer": "cus_Pv4w8dxBpTVUsQ", "customer_address": null, "customer_email": "aapeli@couchers.org", "customer_name": null, "customer_phone": null, "customer_shipping": null, "customer_tax_exempt": "none", "customer_tax_ids": [], "default_payment_method": null, "default_source": null, "default_tax_rates": [], "description": null, "discount": null, "discounts": [], "due_date": null, "effective_at": 1713046273, "ending_balance": 0, "footer": null, "from_invoice": null, "hosted_invoice_url": "https://invoice.stripe.com/i/acct_1KEzByIfR5z29g5k/test_YWNjdF8xS0V6QnlJZlI1ejI5ZzVrLF9QdjR3dzFNVDRGcHo4ZTI1Z05tMXA5WldlMld2VGE2LDEwMzU4NzA3Ng0200xNecenik?s=ap", "invoice_pdf": "https://pay.stripe.com/invoice/acct_1KEzByIfR5z29g5k/test_YWNjdF8xS0V6QnlJZlI1ejI5ZzVrLF9QdjR3dzFNVDRGcHo4ZTI1Z05tMXA5WldlMld2VGE2LDEwMzU4NzA3Ng0200xNecenik/pdf?s=ap", "issuer": {"type": "self"}, "last_finalization_error": null, "latest_revision": null, "lines": {"object": "list", "data": [{"id": "il_1P5EmzIfR5z29g5khRFJxpUq", "object": "line_item", "amount": 2500, "amount_excluding_tax": 2500, "currency": "usd", "description": "25 \u00d7 Couchers financial supporter (Tier 2 at $1.00 / month)", "discount_amounts": [], "discountable": true, "discounts": [], "invoice": "in_1P5EmzIfR5z29g5kNwA5fIXq", "livemode": false, "metadata": {}, "period": {"end": 1715638273, "start": 1713046273}, "plan": {"id": "price_1KIbmbIfR5z29g5kFWPEUnC6", "object": "plan", "active": true, "aggregate_usage": null, "amount": null, "amount_decimal": null, "billing_scheme": "tiered", "created": 1642351245, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_KyYuo4dO67NKtG", "tiers_mode": "volume", "transform_usage": null, "trial_period_days": null, "usage_type": "licensed"}, "price": {"id": "price_1KIbmbIfR5z29g5kFWPEUnC6", "object": "price", "active": true, "billing_scheme": "tiered", "created": 1642351245, "currency": "usd", "custom_unit_amount": null, "livemode": false, "lookup_key": null, "metadata": {}, "nickname": null, "product": "prod_KyYuo4dO67NKtG", "recurring": {"aggregate_usage": null, "interval": "month", "interval_count": 1, "trial_period_days": null, "usage_type": "licensed"}, "tax_behavior": "unspecified", "tiers_mode": "volume", "transform_quantity": null, "type": "recurring", "unit_amount": null, "unit_amount_decimal": null}, "proration": false, "proration_details": {"credited_items": null}, "quantity": 25, "subscription": "sub_1P5EmzIfR5z29g5k2nmkX0l3", "subscription_item": "si_Pv4w0QuX2JUBXm", "tax_amounts": [], "tax_rates": [], "type": "subscription", "unit_amount_excluding_tax": "100"}], "has_more": false, "total_count": 1, "url": "/v1/invoices/in_1P5EmzIfR5z29g5kNwA5fIXq/lines"}, "livemode": false, "metadata": {}, "next_payment_attempt": null, "number": "D86E702F-0001", "on_behalf_of": null, "paid": false, "paid_out_of_band": false, "payment_intent": "pi_3P5EmzIfR5z29g5k0uVvI3kX", "payment_settings": {"default_mandate": null, "payment_method_options": {"acss_debit": null, "bancontact": null, "card": {"request_three_d_secure": "automatic"}, "customer_balance": null, "konbini": null, "sepa_debit": null, "us_bank_account": null}, "payment_method_types": null}, "period_end": 1713046273, "period_start": 1713046273, "post_payment_credit_notes_amount": 0, "pre_payment_credit_notes_amount": 0, "quote": null, "receipt_number": null, "rendering": null, "shipping_cost": null, "shipping_details": null, "starting_balance": 0, "statement_descriptor": null, "status": "open", "status_transitions": {"finalized_at": 1713046273, "marked_uncollectible_at": null, "paid_at": null, "voided_at": null}, "subscription": "sub_1P5EmzIfR5z29g5k2nmkX0l3", "subscription_details": {"metadata": {}}, "subtotal": 2500, "subtotal_excluding_tax": 2500, "tax": null, "test_clock": null, "total": 2500, "total_discount_amounts": [], "total_excluding_tax": 2500, "total_tax_amounts": [], "transfer_data": null, "webhooks_delivered_at": null}}, "livemode": false, "pending_webhooks": 2, "request": {"id": "req_x1PqgmCHBOPD0i", "idempotency_key": "44ec8acd-be18-4de0-af2e-715760e96725"}, "type": "invoice.created"}', 

660 "evt_1P5En3IfR5z29g5k3ElqoMso": '{"id": "evt_1P5En3IfR5z29g5k3ElqoMso", "object": "event", "api_version": "2024-04-10", "created": 1713046275, "data": {"object": {"id": "in_1P5EmzIfR5z29g5kNwA5fIXq", "object": "invoice", "account_country": "US", "account_name": "Couchers, Inc.", "account_tax_ids": null, "amount_due": 2500, "amount_paid": 2500, "amount_remaining": 0, "amount_shipping": 0, "application": null, "application_fee_amount": null, "attempt_count": 1, "attempted": true, "auto_advance": false, "automatic_tax": {"enabled": false, "liability": null, "status": null}, "billing_reason": "subscription_create", "charge": "ch_3P5EmzIfR5z29g5k05Mw6ZV2", "collection_method": "charge_automatically", "created": 1713046273, "currency": "usd", "custom_fields": null, "customer": "cus_Pv4w8dxBpTVUsQ", "customer_address": null, "customer_email": "aapeli@couchers.org", "customer_name": null, "customer_phone": null, "customer_shipping": null, "customer_tax_exempt": "none", "customer_tax_ids": [], "default_payment_method": null, "default_source": null, "default_tax_rates": [], "description": null, "discount": null, "discounts": [], "due_date": null, "effective_at": 1713046273, "ending_balance": 0, "footer": null, "from_invoice": null, "hosted_invoice_url": "https://invoice.stripe.com/i/acct_1KEzByIfR5z29g5k/test_YWNjdF8xS0V6QnlJZlI1ejI5ZzVrLF9QdjR3dzFNVDRGcHo4ZTI1Z05tMXA5WldlMld2VGE2LDEwMzU4NzA3Nw0200Xbr3gdqx?s=ap", "invoice_pdf": "https://pay.stripe.com/invoice/acct_1KEzByIfR5z29g5k/test_YWNjdF8xS0V6QnlJZlI1ejI5ZzVrLF9QdjR3dzFNVDRGcHo4ZTI1Z05tMXA5WldlMld2VGE2LDEwMzU4NzA3Nw0200Xbr3gdqx/pdf?s=ap", "issuer": {"type": "self"}, "last_finalization_error": null, "latest_revision": null, "lines": {"object": "list", "data": [{"id": "il_1P5EmzIfR5z29g5khRFJxpUq", "object": "line_item", "amount": 2500, "amount_excluding_tax": 2500, "currency": "usd", "description": "25 \u00d7 Couchers financial supporter (Tier 2 at $1.00 / month)", "discount_amounts": [], "discountable": true, "discounts": [], "invoice": "in_1P5EmzIfR5z29g5kNwA5fIXq", "livemode": false, "metadata": {}, "period": {"end": 1715638273, "start": 1713046273}, "plan": {"id": "price_1KIbmbIfR5z29g5kFWPEUnC6", "object": "plan", "active": true, "aggregate_usage": null, "amount": null, "amount_decimal": null, "billing_scheme": "tiered", "created": 1642351245, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_KyYuo4dO67NKtG", "tiers_mode": "volume", "transform_usage": null, "trial_period_days": null, "usage_type": "licensed"}, "price": {"id": "price_1KIbmbIfR5z29g5kFWPEUnC6", "object": "price", "active": true, "billing_scheme": "tiered", "created": 1642351245, "currency": "usd", "custom_unit_amount": null, "livemode": false, "lookup_key": null, "metadata": {}, "nickname": null, "product": "prod_KyYuo4dO67NKtG", "recurring": {"aggregate_usage": null, "interval": "month", "interval_count": 1, "trial_period_days": null, "usage_type": "licensed"}, "tax_behavior": "unspecified", "tiers_mode": "volume", "transform_quantity": null, "type": "recurring", "unit_amount": null, "unit_amount_decimal": null}, "proration": false, "proration_details": {"credited_items": null}, "quantity": 25, "subscription": "sub_1P5EmzIfR5z29g5k2nmkX0l3", "subscription_item": "si_Pv4w0QuX2JUBXm", "tax_amounts": [], "tax_rates": [], "type": "subscription", "unit_amount_excluding_tax": "100"}], "has_more": false, "total_count": 1, "url": "/v1/invoices/in_1P5EmzIfR5z29g5kNwA5fIXq/lines"}, "livemode": false, "metadata": {}, "next_payment_attempt": null, "number": "D86E702F-0001", "on_behalf_of": null, "paid": true, "paid_out_of_band": false, "payment_intent": "pi_3P5EmzIfR5z29g5k0uVvI3kX", "payment_settings": {"default_mandate": null, "payment_method_options": {"acss_debit": null, "bancontact": null, "card": {"request_three_d_secure": "automatic"}, "customer_balance": null, "konbini": null, "sepa_debit": null, "us_bank_account": null}, "payment_method_types": null}, "period_end": 1713046273, "period_start": 1713046273, "post_payment_credit_notes_amount": 0, "pre_payment_credit_notes_amount": 0, "quote": null, "receipt_number": null, "rendering": null, "shipping_cost": null, "shipping_details": null, "starting_balance": 0, "statement_descriptor": null, "status": "paid", "status_transitions": {"finalized_at": 1713046273, "marked_uncollectible_at": null, "paid_at": 1713046275, "voided_at": null}, "subscription": "sub_1P5EmzIfR5z29g5k2nmkX0l3", "subscription_details": {"metadata": {}}, "subtotal": 2500, "subtotal_excluding_tax": 2500, "tax": null, "test_clock": null, "total": 2500, "total_discount_amounts": [], "total_excluding_tax": 2500, "total_tax_amounts": [], "transfer_data": null, "webhooks_delivered_at": null}}, "livemode": false, "pending_webhooks": 2, "request": {"id": "req_x1PqgmCHBOPD0i", "idempotency_key": "44ec8acd-be18-4de0-af2e-715760e96725"}, "type": "invoice.payment_succeeded"}', 

661 "evt_1P5En3IfR5z29g5kOoaABPf4": '{"id": "evt_1P5En3IfR5z29g5kOoaABPf4", "object": "event", "api_version": "2024-04-10", "created": 1713046277, "data": {"object": {"id": "cs_test_a1JoMu1FbksL058ob6T6AC1byYR2DCXVRwi0ybLSZKwINYe868OQr25qaC", "object": "checkout.session", "after_expiration": null, "allow_promotion_codes": null, "amount_subtotal": 2500, "amount_total": 2500, "automatic_tax": {"enabled": false, "liability": null, "status": null}, "billing_address_collection": null, "cancel_url": "http://localhost:3000/donate?cancelled=true", "client_reference_id": "1", "client_secret": null, "consent": null, "consent_collection": null, "created": 1713046244, "currency": "usd", "currency_conversion": null, "custom_fields": [], "custom_text": {"after_submit": null, "shipping_address": null, "submit": null, "terms_of_service_acceptance": null}, "customer": "cus_Pv4w8dxBpTVUsQ", "customer_creation": null, "customer_details": {"address": {"city": null, "country": "US", "line1": null, "line2": null, "postal_code": "10001", "state": null}, "email": "aapeli@couchers.org", "name": "Aapeli Vuorinen", "phone": null, "tax_exempt": "none", "tax_ids": []}, "customer_email": null, "expires_at": 1713132644, "invoice": "in_1P5EmzIfR5z29g5kNwA5fIXq", "invoice_creation": null, "livemode": false, "locale": null, "metadata": {}, "mode": "subscription", "payment_intent": null, "payment_link": null, "payment_method_collection": "always", "payment_method_configuration_details": null, "payment_method_options": {"card": {"request_three_d_secure": "automatic"}}, "payment_method_types": ["card"], "payment_status": "paid", "phone_number_collection": {"enabled": false}, "recovered_from": null, "setup_intent": null, "shipping_address_collection": null, "shipping_cost": null, "shipping_details": null, "shipping_options": [], "status": "complete", "submit_type": null, "subscription": "sub_1P5EmzIfR5z29g5k2nmkX0l3", "success_url": "http://localhost:3000/donate?success=true", "total_details": {"amount_discount": 0, "amount_shipping": 0, "amount_tax": 0}, "ui_mode": "hosted", "url": null}}, "livemode": false, "pending_webhooks": 3, "request": {"id": null, "idempotency_key": null}, "type": "checkout.session.completed"}', 

662 "evt_1P5En3IfR5z29g5kRKYnPpgc": '{"id": "evt_1P5En3IfR5z29g5kRKYnPpgc", "object": "event", "api_version": "2024-04-10", "created": 1713046275, "data": {"object": {"id": "in_1P5EmzIfR5z29g5kNwA5fIXq", "object": "invoice", "account_country": "US", "account_name": "Couchers, Inc.", "account_tax_ids": null, "amount_due": 2500, "amount_paid": 2500, "amount_remaining": 0, "amount_shipping": 0, "application": null, "application_fee_amount": null, "attempt_count": 1, "attempted": true, "auto_advance": false, "automatic_tax": {"enabled": false, "liability": null, "status": null}, "billing_reason": "subscription_create", "charge": "ch_3P5EmzIfR5z29g5k05Mw6ZV2", "collection_method": "charge_automatically", "created": 1713046273, "currency": "usd", "custom_fields": null, "customer": "cus_Pv4w8dxBpTVUsQ", "customer_address": null, "customer_email": "aapeli@couchers.org", "customer_name": null, "customer_phone": null, "customer_shipping": null, "customer_tax_exempt": "none", "customer_tax_ids": [], "default_payment_method": null, "default_source": null, "default_tax_rates": [], "description": null, "discount": null, "discounts": [], "due_date": null, "effective_at": 1713046273, "ending_balance": 0, "footer": null, "from_invoice": null, "hosted_invoice_url": "https://invoice.stripe.com/i/acct_1KEzByIfR5z29g5k/test_YWNjdF8xS0V6QnlJZlI1ejI5ZzVrLF9QdjR3dzFNVDRGcHo4ZTI1Z05tMXA5WldlMld2VGE2LDEwMzU4NzA3Ng0200xNecenik?s=ap", "invoice_pdf": "https://pay.stripe.com/invoice/acct_1KEzByIfR5z29g5k/test_YWNjdF8xS0V6QnlJZlI1ejI5ZzVrLF9QdjR3dzFNVDRGcHo4ZTI1Z05tMXA5WldlMld2VGE2LDEwMzU4NzA3Ng0200xNecenik/pdf?s=ap", "issuer": {"type": "self"}, "last_finalization_error": null, "latest_revision": null, "lines": {"object": "list", "data": [{"id": "il_1P5EmzIfR5z29g5khRFJxpUq", "object": "line_item", "amount": 2500, "amount_excluding_tax": 2500, "currency": "usd", "description": "25 \u00d7 Couchers financial supporter (Tier 2 at $1.00 / month)", "discount_amounts": [], "discountable": true, "discounts": [], "invoice": "in_1P5EmzIfR5z29g5kNwA5fIXq", "livemode": false, "metadata": {}, "period": {"end": 1715638273, "start": 1713046273}, "plan": {"id": "price_1KIbmbIfR5z29g5kFWPEUnC6", "object": "plan", "active": true, "aggregate_usage": null, "amount": null, "amount_decimal": null, "billing_scheme": "tiered", "created": 1642351245, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_KyYuo4dO67NKtG", "tiers_mode": "volume", "transform_usage": null, "trial_period_days": null, "usage_type": "licensed"}, "price": {"id": "price_1KIbmbIfR5z29g5kFWPEUnC6", "object": "price", "active": true, "billing_scheme": "tiered", "created": 1642351245, "currency": "usd", "custom_unit_amount": null, "livemode": false, "lookup_key": null, "metadata": {}, "nickname": null, "product": "prod_KyYuo4dO67NKtG", "recurring": {"aggregate_usage": null, "interval": "month", "interval_count": 1, "trial_period_days": null, "usage_type": "licensed"}, "tax_behavior": "unspecified", "tiers_mode": "volume", "transform_quantity": null, "type": "recurring", "unit_amount": null, "unit_amount_decimal": null}, "proration": false, "proration_details": {"credited_items": null}, "quantity": 25, "subscription": "sub_1P5EmzIfR5z29g5k2nmkX0l3", "subscription_item": "si_Pv4w0QuX2JUBXm", "tax_amounts": [], "tax_rates": [], "type": "subscription", "unit_amount_excluding_tax": "100"}], "has_more": false, "total_count": 1, "url": "/v1/invoices/in_1P5EmzIfR5z29g5kNwA5fIXq/lines"}, "livemode": false, "metadata": {}, "next_payment_attempt": null, "number": "D86E702F-0001", "on_behalf_of": null, "paid": true, "paid_out_of_band": false, "payment_intent": "pi_3P5EmzIfR5z29g5k0uVvI3kX", "payment_settings": {"default_mandate": null, "payment_method_options": {"acss_debit": null, "bancontact": null, "card": {"request_three_d_secure": "automatic"}, "customer_balance": null, "konbini": null, "sepa_debit": null, "us_bank_account": null}, "payment_method_types": null}, "period_end": 1713046273, "period_start": 1713046273, "post_payment_credit_notes_amount": 0, "pre_payment_credit_notes_amount": 0, "quote": null, "receipt_number": null, "rendering": null, "shipping_cost": null, "shipping_details": null, "starting_balance": 0, "statement_descriptor": null, "status": "paid", "status_transitions": {"finalized_at": 1713046273, "marked_uncollectible_at": null, "paid_at": 1713046275, "voided_at": null}, "subscription": "sub_1P5EmzIfR5z29g5k2nmkX0l3", "subscription_details": {"metadata": {}}, "subtotal": 2500, "subtotal_excluding_tax": 2500, "tax": null, "test_clock": null, "total": 2500, "total_discount_amounts": [], "total_excluding_tax": 2500, "total_tax_amounts": [], "transfer_data": null, "webhooks_delivered_at": null}, "previous_attributes": {"amount_paid": 0, "amount_remaining": 2500, "attempt_count": 0, "attempted": false, "charge": null, "paid": false, "status": "open", "status_transitions": {"paid_at": null}}}, "livemode": false, "pending_webhooks": 2, "request": {"id": "req_x1PqgmCHBOPD0i", "idempotency_key": "44ec8acd-be18-4de0-af2e-715760e96725"}, "type": "invoice.updated"}', 

663 "evt_1P5En3IfR5z29g5kXDrXUkQa": '{"id": "evt_1P5En3IfR5z29g5kXDrXUkQa", "object": "event", "api_version": "2024-04-10", "created": 1713046275, "data": {"object": {"id": "in_1P5EmzIfR5z29g5kNwA5fIXq", "object": "invoice", "account_country": "US", "account_name": "Couchers, Inc.", "account_tax_ids": null, "amount_due": 2500, "amount_paid": 2500, "amount_remaining": 0, "amount_shipping": 0, "application": null, "application_fee_amount": null, "attempt_count": 1, "attempted": true, "auto_advance": false, "automatic_tax": {"enabled": false, "liability": null, "status": null}, "billing_reason": "subscription_create", "charge": "ch_3P5EmzIfR5z29g5k05Mw6ZV2", "collection_method": "charge_automatically", "created": 1713046273, "currency": "usd", "custom_fields": null, "customer": "cus_Pv4w8dxBpTVUsQ", "customer_address": null, "customer_email": "aapeli@couchers.org", "customer_name": null, "customer_phone": null, "customer_shipping": null, "customer_tax_exempt": "none", "customer_tax_ids": [], "default_payment_method": null, "default_source": null, "default_tax_rates": [], "description": null, "discount": null, "discounts": [], "due_date": null, "effective_at": 1713046273, "ending_balance": 0, "footer": null, "from_invoice": null, "hosted_invoice_url": "https://invoice.stripe.com/i/acct_1KEzByIfR5z29g5k/test_YWNjdF8xS0V6QnlJZlI1ejI5ZzVrLF9QdjR3dzFNVDRGcHo4ZTI1Z05tMXA5WldlMld2VGE2LDEwMzU4NzA3Nw0200Xbr3gdqx?s=ap", "invoice_pdf": "https://pay.stripe.com/invoice/acct_1KEzByIfR5z29g5k/test_YWNjdF8xS0V6QnlJZlI1ejI5ZzVrLF9QdjR3dzFNVDRGcHo4ZTI1Z05tMXA5WldlMld2VGE2LDEwMzU4NzA3Nw0200Xbr3gdqx/pdf?s=ap", "issuer": {"type": "self"}, "last_finalization_error": null, "latest_revision": null, "lines": {"object": "list", "data": [{"id": "il_1P5EmzIfR5z29g5khRFJxpUq", "object": "line_item", "amount": 2500, "amount_excluding_tax": 2500, "currency": "usd", "description": "25 \u00d7 Couchers financial supporter (Tier 2 at $1.00 / month)", "discount_amounts": [], "discountable": true, "discounts": [], "invoice": "in_1P5EmzIfR5z29g5kNwA5fIXq", "livemode": false, "metadata": {}, "period": {"end": 1715638273, "start": 1713046273}, "plan": {"id": "price_1KIbmbIfR5z29g5kFWPEUnC6", "object": "plan", "active": true, "aggregate_usage": null, "amount": null, "amount_decimal": null, "billing_scheme": "tiered", "created": 1642351245, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_KyYuo4dO67NKtG", "tiers_mode": "volume", "transform_usage": null, "trial_period_days": null, "usage_type": "licensed"}, "price": {"id": "price_1KIbmbIfR5z29g5kFWPEUnC6", "object": "price", "active": true, "billing_scheme": "tiered", "created": 1642351245, "currency": "usd", "custom_unit_amount": null, "livemode": false, "lookup_key": null, "metadata": {}, "nickname": null, "product": "prod_KyYuo4dO67NKtG", "recurring": {"aggregate_usage": null, "interval": "month", "interval_count": 1, "trial_period_days": null, "usage_type": "licensed"}, "tax_behavior": "unspecified", "tiers_mode": "volume", "transform_quantity": null, "type": "recurring", "unit_amount": null, "unit_amount_decimal": null}, "proration": false, "proration_details": {"credited_items": null}, "quantity": 25, "subscription": "sub_1P5EmzIfR5z29g5k2nmkX0l3", "subscription_item": "si_Pv4w0QuX2JUBXm", "tax_amounts": [], "tax_rates": [], "type": "subscription", "unit_amount_excluding_tax": "100"}], "has_more": false, "total_count": 1, "url": "/v1/invoices/in_1P5EmzIfR5z29g5kNwA5fIXq/lines"}, "livemode": false, "metadata": {}, "next_payment_attempt": null, "number": "D86E702F-0001", "on_behalf_of": null, "paid": true, "paid_out_of_band": false, "payment_intent": "pi_3P5EmzIfR5z29g5k0uVvI3kX", "payment_settings": {"default_mandate": null, "payment_method_options": {"acss_debit": null, "bancontact": null, "card": {"request_three_d_secure": "automatic"}, "customer_balance": null, "konbini": null, "sepa_debit": null, "us_bank_account": null}, "payment_method_types": null}, "period_end": 1713046273, "period_start": 1713046273, "post_payment_credit_notes_amount": 0, "pre_payment_credit_notes_amount": 0, "quote": null, "receipt_number": null, "rendering": null, "shipping_cost": null, "shipping_details": null, "starting_balance": 0, "statement_descriptor": null, "status": "paid", "status_transitions": {"finalized_at": 1713046273, "marked_uncollectible_at": null, "paid_at": 1713046275, "voided_at": null}, "subscription": "sub_1P5EmzIfR5z29g5k2nmkX0l3", "subscription_details": {"metadata": {}}, "subtotal": 2500, "subtotal_excluding_tax": 2500, "tax": null, "test_clock": null, "total": 2500, "total_discount_amounts": [], "total_excluding_tax": 2500, "total_tax_amounts": [], "transfer_data": null, "webhooks_delivered_at": null}}, "livemode": false, "pending_webhooks": 2, "request": {"id": "req_x1PqgmCHBOPD0i", "idempotency_key": "44ec8acd-be18-4de0-af2e-715760e96725"}, "type": "invoice.paid"}', 

664 "evt_3P5El3IfR5z29g5k0mFVJ2V7": '{"id": "evt_3P5El3IfR5z29g5k0mFVJ2V7", "object": "event", "api_version": "2024-04-10", "created": 1713046153, "data": {"object": {"id": "pi_3P5El3IfR5z29g5k0N5TNa7R", "object": "payment_intent", "amount": 10000, "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_3P5El3IfR5z29g5k0N5TNa7R_secret_BIdVdUUKk8zPCuttemp8Jl4uf", "confirmation_method": "automatic", "created": 1713046153, "currency": "usd", "customer": "cus_Pv4uq0gT0rDZWN", "description": null, "invoice": null, "last_payment_error": null, "latest_charge": null, "livemode": false, "metadata": {}, "next_action": null, "on_behalf_of": null, "payment_method": null, "payment_method_configuration_details": 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": "aapeli@couchers.org", "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}}, "livemode": false, "pending_webhooks": 2, "request": {"id": "req_kVsPqUwBoL4xen", "idempotency_key": "d3051b38-f32b-4118-b456-56897ce6b96d"}, "type": "payment_intent.created"}', 

665 "evt_3P5El3IfR5z29g5k0TLWlfHq": '{"id": "evt_3P5El3IfR5z29g5k0TLWlfHq", "object": "event", "api_version": "2024-04-10", "created": 1713046154, "data": {"object": {"id": "ch_3P5El3IfR5z29g5k03QfMZRt", "object": "charge", "amount": 10000, "amount_captured": 10000, "amount_refunded": 0, "application": null, "application_fee": null, "application_fee_amount": null, "balance_transaction": "txn_3P5El3IfR5z29g5k0Jmn0th5", "billing_details": {"address": {"city": null, "country": "US", "line1": null, "line2": null, "postal_code": "10001", "state": null}, "email": "aapeli@couchers.org", "name": "Aapeli Vuorinen", "phone": null}, "calculated_statement_descriptor": "COUCHERS.ORG", "captured": true, "created": 1713046154, "currency": "usd", "customer": "cus_Pv4uq0gT0rDZWN", "description": null, "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": 31, "seller_message": "Payment complete.", "type": "authorized"}, "paid": true, "payment_intent": "pi_3P5El3IfR5z29g5k0N5TNa7R", "payment_method": "pm_1P5El3IfR5z29g5k33WlbWVC", "payment_method_details": {"card": {"amount_authorized": 10000, "brand": "visa", "checks": {"address_line1_check": null, "address_postal_code_check": "pass", "cvc_check": "pass"}, "country": "US", "exp_month": 12, "exp_year": 2050, "extended_authorization": {"status": "disabled"}, "fingerprint": "2uVHwVtZ157kRjpi", "funding": "credit", "incremental_authorization": {"status": "unavailable"}, "installments": null, "last4": "4242", "mandate": null, "multicapture": {"status": "unavailable"}, "network": "visa", "network_token": {"used": false}, "overcapture": {"maximum_amount_capturable": 10000, "status": "unavailable"}, "three_d_secure": null, "wallet": null}, "type": "card"}, "radar_options": {}, "receipt_email": "aapeli@couchers.org", "receipt_number": null, "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xS0V6QnlJZlI1ejI5ZzVrKIqF7LAGMgbtNxpJulk6LBaePNy_2Q2RzXJsbk7t1jLwK26AQlG05P-4EPhG7AIIcqsQLgC09iDJ2srs", "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}}, "livemode": false, "pending_webhooks": 2, "request": {"id": "req_kVsPqUwBoL4xen", "idempotency_key": "d3051b38-f32b-4118-b456-56897ce6b96d"}, "type": "charge.succeeded"}', 

666 "evt_3P5El3IfR5z29g5k0tueVWGH": '{"id": "evt_3P5El3IfR5z29g5k0tueVWGH", "object": "event", "api_version": "2024-04-10", "created": 1713046154, "data": {"object": {"id": "pi_3P5El3IfR5z29g5k0N5TNa7R", "object": "payment_intent", "amount": 10000, "amount_capturable": 0, "amount_details": {"tip": {}}, "amount_received": 10000, "application": null, "application_fee_amount": null, "automatic_payment_methods": null, "canceled_at": null, "cancellation_reason": null, "capture_method": "automatic", "client_secret": "pi_3P5El3IfR5z29g5k0N5TNa7R_secret_BIdVdUUKk8zPCuttemp8Jl4uf", "confirmation_method": "automatic", "created": 1713046153, "currency": "usd", "customer": "cus_Pv4uq0gT0rDZWN", "description": null, "invoice": null, "last_payment_error": null, "latest_charge": "ch_3P5El3IfR5z29g5k03QfMZRt", "livemode": false, "metadata": {}, "next_action": null, "on_behalf_of": null, "payment_method": "pm_1P5El3IfR5z29g5k33WlbWVC", "payment_method_configuration_details": 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": "aapeli@couchers.org", "review": null, "setup_future_usage": null, "shipping": null, "source": null, "statement_descriptor": null, "statement_descriptor_suffix": null, "status": "succeeded", "transfer_data": null, "transfer_group": null}}, "livemode": false, "pending_webhooks": 3, "request": {"id": "req_kVsPqUwBoL4xen", "idempotency_key": "d3051b38-f32b-4118-b456-56897ce6b96d"}, "type": "payment_intent.succeeded"}', 

667 "evt_3P5EmzIfR5z29g5k0bA1H9Vg": '{"id": "evt_3P5EmzIfR5z29g5k0bA1H9Vg", "object": "event", "api_version": "2024-04-10", "created": 1713046274, "data": {"object": {"id": "ch_3P5EmzIfR5z29g5k05Mw6ZV2", "object": "charge", "amount": 2500, "amount_captured": 2500, "amount_refunded": 0, "application": null, "application_fee": null, "application_fee_amount": null, "balance_transaction": "txn_3P5EmzIfR5z29g5k0U5iEbk1", "billing_details": {"address": {"city": null, "country": "US", "line1": null, "line2": null, "postal_code": "10001", "state": null}, "email": "aapeli@couchers.org", "name": "Aapeli Vuorinen", "phone": null}, "calculated_statement_descriptor": "COUCHERS.ORG", "captured": true, "created": 1713046274, "currency": "usd", "customer": "cus_Pv4w8dxBpTVUsQ", "description": "Subscription creation", "destination": null, "dispute": null, "disputed": false, "failure_balance_transaction": null, "failure_code": null, "failure_message": null, "fraud_details": {}, "invoice": "in_1P5EmzIfR5z29g5kNwA5fIXq", "livemode": false, "metadata": {}, "on_behalf_of": null, "order": null, "outcome": {"network_status": "approved_by_network", "reason": null, "risk_level": "normal", "risk_score": 44, "seller_message": "Payment complete.", "type": "authorized"}, "paid": true, "payment_intent": "pi_3P5EmzIfR5z29g5k0uVvI3kX", "payment_method": "pm_1P5EmyIfR5z29g5kAIZoJcSv", "payment_method_details": {"card": {"amount_authorized": 2500, "brand": "visa", "checks": {"address_line1_check": null, "address_postal_code_check": "pass", "cvc_check": "pass"}, "country": "US", "exp_month": 12, "exp_year": 2050, "extended_authorization": {"status": "disabled"}, "fingerprint": "2uVHwVtZ157kRjpi", "funding": "credit", "incremental_authorization": {"status": "unavailable"}, "installments": null, "last4": "4242", "mandate": null, "multicapture": {"status": "unavailable"}, "network": "visa", "network_token": {"used": false}, "overcapture": {"maximum_amount_capturable": 2500, "status": "unavailable"}, "three_d_secure": null, "wallet": null}, "type": "card"}, "radar_options": {}, "receipt_email": "aapeli@couchers.org", "receipt_number": null, "receipt_url": "https://pay.stripe.com/receipts/invoices/CAcaFwoVYWNjdF8xS0V6QnlJZlI1ejI5ZzVrKIOG7LAGMgYTBIebo2c6LBYFs4BgdV7T4S5nHXQyHt4uh5azZ3_ss_S2wi27m52wbg4yQAoirZ9eBhbH?s=ap", "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}}, "livemode": false, "pending_webhooks": 2, "request": {"id": "req_x1PqgmCHBOPD0i", "idempotency_key": "44ec8acd-be18-4de0-af2e-715760e96725"}, "type": "charge.succeeded"}', 

668 "evt_3P5EmzIfR5z29g5k0bxxQl9f": '{"id": "evt_3P5EmzIfR5z29g5k0bxxQl9f", "object": "event", "api_version": "2024-04-10", "created": 1713046273, "data": {"object": {"id": "pi_3P5EmzIfR5z29g5k0uVvI3kX", "object": "payment_intent", "amount": 2500, "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_3P5EmzIfR5z29g5k0uVvI3kX_secret_mw1JYS1lig6dYcy922zoeyzkK", "confirmation_method": "automatic", "created": 1713046273, "currency": "usd", "customer": "cus_Pv4w8dxBpTVUsQ", "description": "Subscription creation", "invoice": "in_1P5EmzIfR5z29g5kNwA5fIXq", "last_payment_error": null, "latest_charge": null, "livemode": false, "metadata": {}, "next_action": null, "on_behalf_of": null, "payment_method": null, "payment_method_configuration_details": null, "payment_method_options": {"card": {"installments": null, "mandate_options": null, "network": null, "request_three_d_secure": "automatic"}, "cashapp": {}}, "payment_method_types": ["card", "cashapp"], "processing": null, "receipt_email": "aapeli@couchers.org", "review": null, "setup_future_usage": "off_session", "shipping": null, "source": null, "statement_descriptor": null, "statement_descriptor_suffix": null, "status": "requires_payment_method", "transfer_data": null, "transfer_group": null}}, "livemode": false, "pending_webhooks": 2, "request": {"id": "req_x1PqgmCHBOPD0i", "idempotency_key": "44ec8acd-be18-4de0-af2e-715760e96725"}, "type": "payment_intent.created"}', 

669 "evt_3P5EmzIfR5z29g5k0taFsMsl": '{"id": "evt_3P5EmzIfR5z29g5k0taFsMsl", "object": "event", "api_version": "2024-04-10", "created": 1713046274, "data": {"object": {"id": "pi_3P5EmzIfR5z29g5k0uVvI3kX", "object": "payment_intent", "amount": 2500, "amount_capturable": 0, "amount_details": {"tip": {}}, "amount_received": 2500, "application": null, "application_fee_amount": null, "automatic_payment_methods": null, "canceled_at": null, "cancellation_reason": null, "capture_method": "automatic", "client_secret": "pi_3P5EmzIfR5z29g5k0uVvI3kX_secret_mw1JYS1lig6dYcy922zoeyzkK", "confirmation_method": "automatic", "created": 1713046273, "currency": "usd", "customer": "cus_Pv4w8dxBpTVUsQ", "description": "Subscription creation", "invoice": "in_1P5EmzIfR5z29g5kNwA5fIXq", "last_payment_error": null, "latest_charge": "ch_3P5EmzIfR5z29g5k05Mw6ZV2", "livemode": false, "metadata": {}, "next_action": null, "on_behalf_of": null, "payment_method": "pm_1P5EmyIfR5z29g5kAIZoJcSv", "payment_method_configuration_details": null, "payment_method_options": {"card": {"installments": null, "mandate_options": null, "network": null, "request_three_d_secure": "automatic", "setup_future_usage": "off_session"}, "cashapp": {}}, "payment_method_types": ["card", "cashapp"], "processing": null, "receipt_email": "aapeli@couchers.org", "review": null, "setup_future_usage": "off_session", "shipping": null, "source": null, "statement_descriptor": null, "statement_descriptor_suffix": null, "status": "succeeded", "transfer_data": null, "transfer_group": null}}, "livemode": false, "pending_webhooks": 3, "request": {"id": "req_x1PqgmCHBOPD0i", "idempotency_key": "44ec8acd-be18-4de0-af2e-715760e96725"}, "type": "payment_intent.succeeded"}', 

670 # External shop purchase event 

671 "evt_merch_charge_succeeded": '{"id": "evt_merch_charge_succeeded", "object": "event", "api_version": "2024-04-10", "created": 1713046154, "data": {"object": {"id": "ch_merch_test_12345", "object": "charge", "amount": 5000, "amount_captured": 5000, "amount_refunded": 0, "application": null, "application_fee": null, "application_fee_amount": null, "balance_transaction": "txn_merch_test", "billing_details": {"address": {"city": null, "country": "US", "line1": null, "line2": null, "postal_code": "10001", "state": null}, "email": "test@couchers.org.invalid", "name": "Test User", "phone": null}, "calculated_statement_descriptor": "COUCHERS.ORG", "captured": true, "created": 1713046154, "currency": "usd", "customer": null, "description": null, "destination": null, "dispute": null, "disputed": false, "failure_balance_transaction": null, "failure_code": null, "failure_message": null, "fraud_details": {}, "invoice": null, "livemode": false, "metadata": {"checkout_type": "adaptive_pricing_checkout", "site_url": "https://shop.couchershq.org", "payment_type": "single"}, "on_behalf_of": null, "order": null, "outcome": {"network_status": "approved_by_network", "reason": null, "risk_level": "normal", "risk_score": 31, "seller_message": "Payment complete.", "type": "authorized"}, "paid": true, "payment_intent": "pi_merch_test_12345", "payment_method": "pm_merch_test", "payment_method_details": {"card": {"amount_authorized": 5000, "brand": "visa", "checks": {"address_line1_check": null, "address_postal_code_check": "pass", "cvc_check": "pass"}, "country": "US", "exp_month": 12, "exp_year": 2050, "extended_authorization": {"status": "disabled"}, "fingerprint": "2uVHwVtZ157kRjpi", "funding": "credit", "incremental_authorization": {"status": "unavailable"}, "installments": null, "last4": "4242", "mandate": null, "multicapture": {"status": "unavailable"}, "network": "visa", "network_token": {"used": false}, "overcapture": {"maximum_amount_capturable": 5000, "status": "unavailable"}, "three_d_secure": null, "wallet": null}, "type": "card"}, "radar_options": {}, "receipt_email": "test@example.org", "receipt_number": null, "receipt_url": "https://pay.stripe.com/receipts/merch_test", "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}}, "livemode": false, "pending_webhooks": 2, "request": {"id": "req_merch_test", "idempotency_key": "merch-test-key"}, "type": "charge.succeeded"}', 

672} 

673 

674one_time_STRIPE_SESSION = json.loads( 

675 '{"id": "cs_test_a12ftevGwzCAa236NeLPq6yRAdMt0V2S1gGjFcxfsY4xT4tiREPvbr5lhG", "object": "checkout.session", "after_expiration": null, "allow_promotion_codes": null, "amount_subtotal": 10000, "amount_total": 10000, "automatic_tax": {"enabled": false, "liability": null, "status": null}, "billing_address_collection": null, "cancel_url": "http://localhost:3000/donate?cancelled=true", "client_reference_id": "1", "client_secret": null, "consent": null, "consent_collection": null, "created": 1713046124, "currency": "usd", "currency_conversion": null, "custom_fields": [], "custom_text": {"after_submit": null, "shipping_address": null, "submit": null, "terms_of_service_acceptance": null}, "customer": "cus_Pv4uq0gT0rDZWN", "customer_creation": null, "customer_details": {"address": null, "email": "aapeli@couchers.org", "name": null, "phone": null, "tax_exempt": "none", "tax_ids": null}, "customer_email": null, "expires_at": 1713132523, "invoice": null, "invoice_creation": {"enabled": false, "invoice_data": {"account_tax_ids": null, "custom_fields": null, "description": null, "footer": null, "issuer": null, "metadata": {}, "rendering_options": null}}, "livemode": false, "locale": null, "metadata": {}, "mode": "payment", "payment_intent": null, "payment_link": null, "payment_method_collection": "if_required", "payment_method_configuration_details": null, "payment_method_options": {"card": {"request_three_d_secure": "automatic"}}, "payment_method_types": ["card"], "payment_status": "unpaid", "phone_number_collection": {"enabled": false}, "recovered_from": null, "setup_intent": null, "shipping_address_collection": null, "shipping_cost": null, "shipping_details": null, "shipping_options": [], "status": "open", "submit_type": "donate", "subscription": null, "success_url": "http://localhost:3000/donate?success=true", "total_details": {"amount_discount": 0, "amount_shipping": 0, "amount_tax": 0}, "ui_mode": "hosted", "url": "https://checkout.stripe.com/c/pay/cs_test_a12ftevGwzCAa236NeLPq6yRAdMt0V2S1gGjFcxfsY4xT4tiREPvbr5lhG#fidkdWxOYHwnPyd1blpxYHZxWjA0TkB%2FR3xMY1cwfzc8YjBua0NNSEZjVUhUd2h%2FYW1yQGlLaU9tXVNoMVE3ZE1QQEluajNiS3xEaVxxQ3xXT1J%2FU3dWb3NhSUhIf2tXTmpVNUpUMzJDaGZLNTVVTmhTcEJocycpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl"}' 

676) 

677RECURRING_STRIPE_SESSION = json.loads( 

678 '{"id": "cs_test_a1JoMu1FbksL058ob6T6AC1byYR2DCXVRwi0ybLSZKwINYe868OQr25qaC", "object": "checkout.session", "after_expiration": null, "allow_promotion_codes": null, "amount_subtotal": 2500, "amount_total": 2500, "automatic_tax": {"enabled": false, "liability": null, "status": null}, "billing_address_collection": null, "cancel_url": "http://localhost:3000/donate?cancelled=true", "client_reference_id": "1", "client_secret": null, "consent": null, "consent_collection": null, "created": 1713046244, "currency": "usd", "currency_conversion": null, "custom_fields": [], "custom_text": {"after_submit": null, "shipping_address": null, "submit": null, "terms_of_service_acceptance": null}, "customer": "cus_Pv4w8dxBpTVUsQ", "customer_creation": null, "customer_details": {"address": null, "email": "aapeli@couchers.org", "name": null, "phone": null, "tax_exempt": "none", "tax_ids": null}, "customer_email": null, "expires_at": 1713132644, "invoice": null, "invoice_creation": null, "livemode": false, "locale": null, "metadata": {}, "mode": "subscription", "payment_intent": null, "payment_link": null, "payment_method_collection": "always", "payment_method_configuration_details": null, "payment_method_options": {"card": {"request_three_d_secure": "automatic"}}, "payment_method_types": ["card"], "payment_status": "unpaid", "phone_number_collection": {"enabled": false}, "recovered_from": null, "setup_intent": null, "shipping_address_collection": null, "shipping_cost": null, "shipping_details": null, "shipping_options": [], "status": "open", "submit_type": null, "subscription": null, "success_url": "http://localhost:3000/donate?success=true", "total_details": {"amount_discount": 0, "amount_shipping": 0, "amount_tax": 0}, "ui_mode": "hosted", "url": "https://checkout.stripe.com/c/pay/cs_test_a1JoMu1FbksL058ob6T6AC1byYR2DCXVRwi0ybLSZKwINYe868OQr25qaC#fid2cGd2ZndsdXFsamtQa2x0cGBrYHZ2QGtkZ2lgYSc%2FY2RpdmApJ2R1bE5gfCc%2FJ3VuWnFgdnFaMDROQH9HfExjVzB%2FNzxiMG5rQ01IRmNVSFR3aH9hbXJAaUtpT21dU2gxUTdkTVBASW5qM2JLfERpXHFDfFdPUn9Td1Zvc2FJSEh%2Fa1dOalU1SlQzMkNoZks1NVVOaFNwQmhzJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpscWBoJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl"}' 

679)