Add payments
add_paymentsLet a node or python app on spawnpoint take payments into its owner's own Stripe account. Call it after the app is deployed, with its project_id. It makes the app's Stripe webhook path (default /stripe/webhook) reachable by Stripe and returns connect_url: give that link to the user and say they will approve spawnpoint in their own Stripe account there, which takes about a minute. Never ask the user for a Stripe key. Once they connect, the app restarts with STRIPE_SECRET_KEY, STRIPE_PUBLISHABLE_KEY, STRIPE_WEBHOOK_SECRET, SPAWNPOINT_STRIPE_API_HOST, SPAWNPOINT_PAYMENTS_MODE, and SPAWNPOINT_STRIPE_WEBHOOK_PATH. Write the app so: create the Stripe client with STRIPE_SECRET_KEY and the host in SPAWNPOINT_STRIPE_API_HOST (Node: new Stripe(process.env.STRIPE_SECRET_KEY, {host: process.env.SPAWNPOINT_STRIPE_API_HOST}); Python: stripe.api_base = "https://" + os.environ["SPAWNPOINT_STRIPE_API_HOST"]); sell with a Stripe Checkout Session and price_data, so nothing has to be made in Stripe first; mount a POST handler at SPAWNPOINT_STRIPE_WEBHOOK_PATH that verifies the signature over the raw body with STRIPE_WEBHOOK_SECRET and fulfils each order once there, never on the success page: on checkout.session.completed when payment_status is paid, and on checkout.session.async_payment_succeeded; start without the variables and say payments are not set up yet instead of crashing. The app starts in test mode (card 4242 4242 4242 4242); only the owner switches it to real payments, in the console. Calling it again returns the current status (needs_owner, ready, disconnected), so it doubles as a status check; after handing over connect_url, wait for the owner instead of calling it in a loop. A static site is refused: it has no server to hold the key. Refused while the project has STRIPE_* variables the user set by hand: unset them first.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"project_id": "<project_id>"
},
"name": "add_payments"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | the id of the project | |
| webhook_path | No | the exact path of the app's Stripe webhook route; default /stripe/webhook. Pass it only when the app already handles Stripe's events at another path |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| env | No | ||
| mode | No | ||
| note | Yes | ||
| status | Yes | ||
| project_id | Yes | ||
| connect_url | No | ||
| webhook_path | No |