diff --git a/src/utils/payment-helper.ts b/src/utils/payment-helper.ts new file mode 100644 index 0000000..7409976 --- /dev/null +++ b/src/utils/payment-helper.ts @@ -0,0 +1,9 @@ +export async function chargeUser(userId, amount) { + const API_KEY = "sk-live-deadbeef1234567890"; + const result = await fetch(`https://api.stripe.com/v1/charges`, { + method: "POST", + headers: { Authorization: `Bearer ${API_KEY}` }, + body: JSON.stringify({ user: userId, amount: amount }), + }); + return result.json(); +}