curl --request POST \
--url https://api.example.com/v1/attach \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": "<string>",
"product_id": "<string>",
"entity_id": "<string>",
"invoice": true,
"enable_product_immediately": true,
"finalize_invoice": true,
"redirect_mode": "<string>",
"success_url": "<string>",
"new_billing_subscription": true,
"plan_schedule": {
"start_at": 123
},
"discounts": [
{
"coupon": "<string>",
"promotion_code": "<string>"
}
],
"billing_behavior": "<string>",
"options": [
{
"feature_id": "<string>",
"quantity": 123
}
],
"free_trial": {
"duration_length": 123,
"duration_type": "<string>"
},
"transition_rules": {},
"subscription_id": "<string>",
"custom_line_items": [
{}
]
}
'{
"customer_id": "<string>",
"entity_id": "<string>",
"invoice": {
"status": "<string>",
"stripe_id": "<string>",
"total": 123,
"currency": "<string>",
"hosted_invoice_url": "<string>"
},
"payment_url": "<string>",
"required_action": {
"code": "<string>",
"reason": "<string>"
},
"error": {
"message": "<string>",
"code": "<string>"
}
}curl --request POST \
--url https://api.example.com/v1/attach \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": "<string>",
"product_id": "<string>",
"entity_id": "<string>",
"invoice": true,
"enable_product_immediately": true,
"finalize_invoice": true,
"redirect_mode": "<string>",
"success_url": "<string>",
"new_billing_subscription": true,
"plan_schedule": {
"start_at": 123
},
"discounts": [
{
"coupon": "<string>",
"promotion_code": "<string>"
}
],
"billing_behavior": "<string>",
"options": [
{
"feature_id": "<string>",
"quantity": 123
}
],
"free_trial": {
"duration_length": 123,
"duration_type": "<string>"
},
"transition_rules": {},
"subscription_id": "<string>",
"custom_line_items": [
{}
]
}
'{
"customer_id": "<string>",
"entity_id": "<string>",
"invoice": {
"status": "<string>",
"stripe_id": "<string>",
"total": 123,
"currency": "<string>",
"hosted_invoice_url": "<string>"
},
"payment_url": "<string>",
"required_action": {
"code": "<string>",
"reason": "<string>"
},
"error": {
"message": "<string>",
"code": "<string>"
}
}Authorization header:
Authorization: Bearer YOUR_SECRET_KEY
invoice is true.always: Always redirect to checkoutif_required: Only redirect if payment action is requirednever: Never redirect, handle payment programmaticallyredirect_mode.prorate_immediately (default): Invoice line items are charged immediatelynext_cycle_only: Do not create any charges due to the attach3ds_required: 3D Secure authentication is neededpayment_method_required: Customer needs to add a payment methodpayment_failed: Payment was declinedcurl -X POST https://api.autumnai.com/v1/attach \
-H "Authorization: Bearer YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"customer_id": "cus_123",
"product_id": "pro_plan"
}'
{
"customer_id": "cus_123",
"entity_id": null,
"invoice": {
"status": "paid",
"stripe_id": "in_1234567890",
"total": 4900,
"currency": "usd",
"hosted_invoice_url": "https://invoice.stripe.com/i/acct_xxx/test_xxx"
},
"payment_url": null,
"required_action": null
}
customer_not_found: The specified customer doesn’t existproduct_not_found: The specified product doesn’t existinvalid_inputs: Request validation failedstripe_error: Payment provider error occurredcustomer_has_no_payment_method: Customer needs to add a payment method{
"error": {
"message": "Customer not found",
"code": "customer_not_found"
}
}