~15 min
Using sandbox API -- no real data affected
Step 1 of 3
1
2
3
Steps
1
Create a Checkout Session
A checkout session represents a single payment intent. It contains the line items, amounts, and redirect URLs. The server validates all amounts and calculates commissions server-side -- never trust client-sent totals.
Instructions
Configure your checkout session below. Add line items with names and amounts. The idempotency key is auto-generated to prevent duplicate charges on network retries.
Expected: Fill in line items and URLs
Parameters
Code Preview
Updates as you fill in parameterscreate-session.ts
const response = await fetch(
'https://sandbox.api.soft.house/acp/checkout-sessions',
{
method: 'POST',
headers: {
'Authorization': 'Bearer sandbox_demo_key',
'Content-Type': 'application/json',
'Idempotency-Key': `checkout_${Date.now()}`, // VOCABULARY-FIREWALL-OK: developer-tutorial-shows-acp-http-header
},
body: JSON.stringify({
items: [
{
name: 'Premium AI Agent Subscription',
amount: 49.99,
currency: 'USD',
quantity: 1,
}
],
success_url: 'https://yourapp.com/success',
cancel_url: 'https://yourapp.com/cancel',
}),
}
);
const session = await response.json();
console.log(`Session ID: ${session.id}`);
console.log(`Checkout URL: ${session.checkout_url}`);