Create Subscription by Hosted Page
Create a subscription using a hosted page. Relevant to card payments.
Note
This method replaces the following deprecated endpoint: post /v1/checkout/subscription
Rapyd continues to support the deprecated endpoint. No sunset date has been set.
/v1/checkout/subscriptions
Create Subscription by Hosted Page
curl -X post 'https://sandboxapi.rapyd.net/v1/checkout/subscriptions' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'idempotency: your-idempotency-parameter-here' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here' \ --data-raw '{ "customer": "cus_4e25112ac20e144ad073a614dc46934b", "country": "IS", "billing": "pay_automatically", "payment_method_": "card_0ef78a1d5cbd4d84133c8d94b2d34a4f", "subscription_items": [ { "plan": "plan_27921a1d4ebeb2db2e6aadf69a0094b1", "quantity": 1 } ], "complete_payment_url": "https://complete.rapyd.net", "error_payment_url": "https://error.rapyd.net", "page_expiration": 1795276710, "merchant_main_button": "pay" }'{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "45658970-a9f2-406b-8fa6-834fd377aef8" }, "data": { "id": "hp_sub_2c95c21982da9182db37a0182a5a80dd", "status": "NEW", "cancel_url": "https://example1234.net", "complete_url": "https://example1234.net", "language": "", "merchant_color": "323fff", "merchant_logo": "", "merchant_website": "https://example1234.net", "merchant_customer_support": { "url": "https://example1234.net", "email": "support@example1234.net", "phone_number": "121255551213" }, "merchant_alias": "Doc Team", "merchant_terms": "https://example1234.net/terms_and_conditions", "merchant_privacy_policy": "https://example1234.net/privacy_policy", "page_expiration": 1764160568, "redirect_url": "https://sandboxcheckout.rapyd.net/subscription?token=hp_sub_2c95c21982da9182db37a0182a5a80dd", "merchant_main_button": "pay", "subscription_items": [ { "id": "", "plan": { "id": "8993ac69-bd12-4cf2-aa8f-019081441303", "tiers": [], "token": "plan_27921a1d4ebeb2db2e6aadf69a0094b1", "amount": 5, "product": null, "interval": "month", "metadata": {}, "nickname": "Basic", "created_at": 1669022872, "deleted_at": 0, "tiers_mode": "", "usage_type": "licensed", "product_name": "Music Streaming", "product_type": "services", "currency_code": "USD", "product_token": "product_8a9a3932967cb7f2caf91d3cc07be5c8", "billing_scheme": "per_unit", "interval_count": 1, "aggregate_usage": "sum", "organization_id": "", "transform_usage": {}, "product_is_active": 1, "trial_period_days": 0, "transform_usage_round": "up", "transform_usage_divide_by": 1 }, "token": "", "org_id": "", "created": 0, "deleted": false, "prorate": true, "quantity": 1, "plan_token": "plan_27921a1d4ebeb2db2e6aadf69a0094b1", "clear_usage": false, "proration_date": 0 } ], "customer": "cus_4e25112ac20e144ad073a614dc46934b", "customer_payment_methods": [], "bank_redirect_customer_payment_methods": [], "country": "IS", "trial_from_plan": false, "trial_period_days": 0, "tax_percent": 0, "billing_cycle_anchor": 0, "billing": "pay_automatically", "cancel_checkout_url": "https://example1234.net", "complete_checkout_url": "https://example1234.net", "payment": { "amount": null, "original_amount": 0, "is_partial": false, "currency_code": "", "country_code": "", "status": "", "description": "", "merchant_reference_id": "", "customer_token": "", "payment_method": "", "payment_method_data": {}, "expiration": 0, "captured": false, "refunded": false, "refunded_amount": 0, "receipt_email": "", "complete_payment_url": "", "error_payment_url": "", "receipt_number": "", "flow_type": "", "address": null, "statement_descriptor": "", "transaction_id": "", "metadata": null, "failure_code": "", "failure_message": "", "paid": false, "paid_at": 0, "dispute": null, "refunds": null, "order": null, "outcome": null, "visual_codes": {}, "textual_codes": {}, "instructions": {}, "ewallet_id": null, "ewallets": [], "payment_method_options": {}, "payment_method_type": "", "payment_method_type_category": "", "fx_rate": "", "merchant_requested_currency": null, "merchant_requested_amount": null, "fixed_side": "", "payment_fees": null, "invoice": "", "escrow": null, "group_payment": "", "cancel_reason": null, "initiation_type": "", "mid": "", "next_action": "not_applicable", "merchant_ewallet": null }, "custom_elements": { "hide_save_card": false, "save_card_default": false, "display_description": false, "payment_fees_display": true, "merchant_currency_only": false, "billing_address_collect": false, "dynamic_currency_conversion": false }, "payment_method_type": "" } }
Create Subscription by Hosted Page with Trial Period
curl -X post'https://sandboxapi.rapyd.net/v1/checkout/subscriptions' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'idempotency: your-idempotency-parameter-here' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here' \ --data-raw '{ "customer": "cus_4e25112ac20e144ad073a614dc46934b", "country": "IS", "billing": "pay_automatically", "payment_method_": "card_0ef78a1d5cbd4d84133c8d94b2d34a4f", "subscription_items": [ { "plan": "plan_27921a1d4ebeb2db2e6aadf69a0094b1", "quantity": 1 } ], "complete_payment_url": "https://complete.rapyd.net", "error_payment_url": "https://error.rapyd.net", "page_expiration": 1795276710, "merchant_main_button": "pay", "cancel_at_period_end": true, "trial_end": 1795276710, "trial_from_plan": false }'{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "1c53ec2b-73f8-474a-b76e-55cd8b13994f" }, "data": { "id": "hp_sub_2e44f86f1970448810e53f306efae10b", "status": "NEW", "cancel_url": "https://example1234.net", "complete_url": "https://example1234.net", "language": "", "merchant_color": "323fff", "merchant_logo": "", "merchant_website": "https://example1234.net", "merchant_customer_support": { "url": "https://example1234.net", "email": "support@example1234.net", "phone_number": "121255551213" }, "merchant_alias": "Doc Team", "merchant_terms": "https://example1234.net/terms_and_conditions", "merchant_privacy_policy": "https://example1234.net/privacy_policy", "page_expiration": 1764160819, "redirect_url": "https://sandboxcheckout.rapyd.net/subscription?token=hp_sub_2e44f86f1970448810e53f306efae10b", "merchant_main_button": "start_trial", "subscription_items": [ { "id": "", "plan": { "id": "8993ac69-bd12-4cf2-aa8f-019081441303", "tiers": [], "token": "plan_27921a1d4ebeb2db2e6aadf69a0094b1", "amount": 5, "product": null, "interval": "month", "metadata": {}, "nickname": "Basic", "created_at": 1669022872, "deleted_at": 0, "tiers_mode": "", "usage_type": "licensed", "product_name": "Music Streaming", "product_type": "services", "currency_code": "USD", "product_token": "product_8a9a3932967cb7f2caf91d3cc07be5c8", "billing_scheme": "per_unit", "interval_count": 1, "aggregate_usage": "sum", "organization_id": "", "transform_usage": {}, "product_is_active": 1, "trial_period_days": 0, "transform_usage_round": "up", "transform_usage_divide_by": 1 }, "token": "", "org_id": "", "created": 0, "deleted": false, "prorate": true, "quantity": 1, "plan_token": "plan_27921a1d4ebeb2db2e6aadf69a0094b1", "clear_usage": false, "proration_date": 0 } ], "customer": "cus_4e25112ac20e144ad073a614dc46934b", "customer_payment_methods": [], "bank_redirect_customer_payment_methods": [], "country": "IS", "trial_end": 1795276710, "trial_from_plan": false, "trial_period_days": 0, "tax_percent": 0, "billing_cycle_anchor": 0, "billing": "pay_automatically", "cancel_checkout_url": "https://example1234.net", "complete_checkout_url": "https://example1234.net", "payment": { "amount": null, "original_amount": 0, "is_partial": false, "currency_code": "", "country_code": "", "status": "", "description": "", "merchant_reference_id": "", "customer_token": "", "payment_method": "", "payment_method_data": {}, "expiration": 0, "captured": false, "refunded": false, "refunded_amount": 0, "receipt_email": "", "complete_payment_url": "", "error_payment_url": "", "receipt_number": "", "flow_type": "", "address": null, "statement_descriptor": "", "transaction_id": "", "metadata": null, "failure_code": "", "failure_message": "", "paid": false, "paid_at": 0, "dispute": null, "refunds": null, "order": null, "outcome": null, "visual_codes": {}, "textual_codes": {}, "instructions": {}, "ewallet_id": null, "ewallets": [], "payment_method_options": {}, "payment_method_type": "", "payment_method_type_category": "", "fx_rate": "", "merchant_requested_currency": null, "merchant_requested_amount": null, "fixed_side": "", "payment_fees": null, "invoice": "", "escrow": null, "group_payment": "", "cancel_reason": null, "initiation_type": "", "mid": "", "next_action": "not_applicable", "merchant_ewallet": null }, "custom_elements": { "hide_save_card": false, "save_card_default": false, "display_description": false, "payment_fees_display": true, "merchant_currency_only": false, "billing_address_collect": false, "dynamic_currency_conversion": false }, "payment_method_type": "" } }
Create Subscription by Hosted Page with Coupon
curl -X post 'https://sandboxapi.rapyd.net/v1/checkout/subscriptions' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'idempotency: your-idempotency-parameter-here' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here' \ --data-raw '{ "customer": "cus_4e25112ac20e144ad073a614dc46934b", "country": "IS", "billing": "pay_automatically", "payment_method_": "card_0ef78a1d5cbd4d84133c8d94b2d34a4f", "subscription_items": [ { "plan": "plan_27921a1d4ebeb2db2e6aadf69a0094b1", "quantity": 1 } ], "complete_payment_url": "https://complete.rapyd.net", "error_payment_url": "https://error.rapyd.net", "page_expiration": 1795276710, "merchant_main_button": "pay", "coupon": "coupon_e4ea7af090c212aa2634b6d88a308a80" }'{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "b20242dc-4147-4300-b701-e5c2fb19a62b" }, "data": { "id": "hp_sub_bb61e733db533c95125ab96c24a97cb3", "status": "NEW", "cancel_url": "https://example1234.net", "complete_url": "https://example1234.net", "language": "", "merchant_color": "323fff", "merchant_logo": "", "merchant_website": "https://example1234.net", "merchant_customer_support": { "url": "https://example1234.net", "email": "support@example1234.net", "phone_number": "121255551213" }, "merchant_alias": "Doc Team", "merchant_terms": "https://example1234.net/terms_and_conditions", "merchant_privacy_policy": "https://example1234.net/privacy_policy", "page_expiration": 1764161258, "redirect_url": "https://sandboxcheckout.rapyd.net/subscription?token=hp_sub_bb61e733db533c95125ab96c24a97cb3", "merchant_main_button": "pay", "subscription_items": [ { "id": "", "plan": { "id": "8993ac69-bd12-4cf2-aa8f-019081441303", "tiers": [], "token": "plan_27921a1d4ebeb2db2e6aadf69a0094b1", "amount": 5, "product": null, "interval": "month", "metadata": {}, "nickname": "Basic", "created_at": 1669022872, "deleted_at": 0, "tiers_mode": "", "usage_type": "licensed", "product_name": "Music Streaming", "product_type": "services", "currency_code": "USD", "product_token": "product_8a9a3932967cb7f2caf91d3cc07be5c8", "billing_scheme": "per_unit", "interval_count": 1, "aggregate_usage": "sum", "organization_id": "", "transform_usage": {}, "product_is_active": 1, "trial_period_days": 0, "transform_usage_round": "up", "transform_usage_divide_by": 1 }, "token": "", "org_id": "", "created": 0, "deleted": false, "prorate": true, "quantity": 1, "plan_token": "plan_27921a1d4ebeb2db2e6aadf69a0094b1", "clear_usage": false, "proration_date": 0 } ], "customer": "cus_4e25112ac20e144ad073a614dc46934b", "customer_payment_methods": [], "bank_redirect_customer_payment_methods": [], "country": "IS", "trial_from_plan": false, "trial_period_days": 0, "tax_percent": 0, "billing_cycle_anchor": 0, "billing": "pay_automatically", "cancel_checkout_url": "https://example1234.net", "complete_checkout_url": "https://example1234.net", "payment": { "amount": null, "original_amount": 0, "is_partial": false, "currency_code": "", "country_code": "", "status": "", "description": "", "merchant_reference_id": "", "customer_token": "", "payment_method": "", "payment_method_data": {}, "expiration": 0, "captured": false, "refunded": false, "refunded_amount": 0, "receipt_email": "", "complete_payment_url": "", "error_payment_url": "", "receipt_number": "", "flow_type": "", "address": null, "statement_descriptor": "", "transaction_id": "", "metadata": null, "failure_code": "", "failure_message": "", "paid": false, "paid_at": 0, "dispute": null, "refunds": null, "order": null, "outcome": null, "visual_codes": {}, "textual_codes": {}, "instructions": {}, "ewallet_id": null, "ewallets": [], "payment_method_options": {}, "payment_method_type": "", "payment_method_type_category": "", "fx_rate": "", "merchant_requested_currency": null, "merchant_requested_amount": null, "fixed_side": "", "payment_fees": null, "invoice": "", "escrow": null, "group_payment": "", "cancel_reason": null, "initiation_type": "", "mid": "", "next_action": "not_applicable", "merchant_ewallet": null }, "custom_elements": { "hide_save_card": false, "save_card_default": false, "display_description": false, "payment_fees_display": true, "merchant_currency_only": false, "billing_address_collect": false, "dynamic_currency_conversion": false }, "payment_method_type": "", "coupon": "coupon_e4ea7af090c212aa2634b6d88a308a80" } }