Create a Stripe Checkout Session
Create a Stripe Checkout Session with Sphere tax applied.
Send Stripe's Checkout parameters under stripe, and the buyer Sphere needs to price under sphere. Sphere calculates tax, expresses it as Tax Rate objects in your account, creates the Checkout Session with those rates and returns it. Redirect to url (hosted) or mount client_secret (embedded) exactly as you do today. When the session completes, call the complete endpoint (or let Sphere's webhook do it) so renewals are taxed by Sphere.
Stripe's Checkout parameters and Sphere's pricing inputs, kept apart.
nullPattern: ^acct_Stripe's session and Sphere's tax, kept apart as on the way in.
Validation error, keyed by the failing field.
Missing/invalid API key, or Stripe account not enabled for Sphere tax.
No such connected Stripe account.
No address to calculate from, or Sphere could not calculate tax.
Stripe refused the Checkout Session.
POST /v1/stripe/checkout_sessions HTTP/1.1
Host: api.getsphere.com
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 880
{
"stripe_account_id": "text",
"stripe": {
"mode": "subscription",
"currency": "text",
"line_items": [
{
"price": "text",
"quantity": 1,
"adjustable_quantity": {
"ANY_ADDITIONAL_PROPERTY": "anything"
}
}
],
"customer_id": "text",
"customer_email": "text",
"success_url": "text",
"cancel_url": "text",
"return_url": "text",
"metadata": {
"ANY_ADDITIONAL_PROPERTY": "text"
},
"subscription_data": {
"metadata": {
"ANY_ADDITIONAL_PROPERTY": "text"
}
},
"allow_promotion_codes": true,
"ui_mode": "hosted",
"client_reference_id": "text",
"locale": "text"
},
"sphere": {
"variant": "merchant_supplied",
"customer_name": "text",
"shipping_address": {
"line1": "text",
"line2": "text",
"city": "text",
"state": "text",
"postal_code": "text",
"country": "text"
},
"billing_address": {
"line1": "text",
"line2": "text",
"city": "text",
"state": "text",
"postal_code": "text",
"country": "text"
},
"tax_ids": [
{
"value": "text",
"country": "text",
"tax_id_type": "text"
}
],
"locale": "text"
}
}{
"stripe_account_id": "text",
"stripe": {
"id": "text",
"url": "text",
"client_secret": "text",
"status": "text",
"amount_subtotal": 1,
"amount_tax": 1,
"amount_total": 1
},
"sphere": {
"tax_calculation_id": "text",
"tax_rate_ids": [
"text"
],
"tax_lines": [
{
"amount": 1,
"taxable_amount": 1,
"taxability_reason": "text",
"display_name": "text",
"percentage": 1,
"inclusive": true,
"jurisdiction": "text",
"country": "text",
"state": "text",
"tax_type": "text"
}
]
}
}Last updated
Was this helpful?