Hosted pages are the easiest and most secure way to integrate chargebee with your website. By using hosted pages, you can avoid the sensitive card information passing through your server and be compliant with most of the PCI DSS requirements.
When you request for a hosted page, a secure & unique URL will be returned which you could either embed or redirect depending upon the embed parameter value that you had passed.
Specifying "embed" parameter as true allows you to embed the "hosted page" in an iframe in your own website. This helps you provide the best experience to your user as they do not have to leave your website to provide card information. Drawbacks are
- Your site should also be in https
- You have to be careful with height and width of the iframe otherwise users might get scroll.
To use the hosted pages, you must configure Redirect URL in the Chargebee web interface under HOSTED PAGES SETTINGS -> Configuration. The configured redirect URL will be called with the following parameters after user had submitted the page.
- id - unique identifier of the hosted page resource
- state - succeeded, failed or cancelled
After the Redirect URL is called by Chargebee with the above parameters, the details of the hosted page can be fetched using Retrieve a hosted page API. The content attribute will have the details about the customer, subscription, card & invoice based on the type of the hosted page.
For Checkout New Subscription:
- Customer - The details about the new customer created.
- Subscription - The details about the new subscription created.
- Card - The details about the card provided while subscribing.
- Invoice - The details about the invoice, if one is generated.
For Checkout Existing Subscription:
- Customer - The updated details of the customer.
- Subscription - The updated details of the subscription.
- Card - The details about the card provided while subscribing.
- Invoice - The details about the invoice, if one is generated.
For Update Payment Method:
- Customer - The details about the customer for whom the card was updated.
- Card - The details about the updated card. It will be present only if the type of payment method is card.
When an embedded hosted page is cancelled by your end user, the content attribute will have the unmodified details of customer, subscription & card resources.
Sample hosted page [ JSON ]
{
"created_at": 1517505996,
"embed": true,
"expires_at": 1517509596,
"id": "__test__znukwBn17fojRqcSm5uZtxxn99WgF5gcu",
"object": "hosted_page",
"resource_version": 1517505996000,
"state": "created",
"type": "checkout_new",
"updated_at": 1517505996,
"url": "https://yourapp.chargebee.com/pages/v2/__test__znukwBn17fojRqcSm5uZtxxn99WgF5gcu/checkout"
}
Unique identifier generated for each hosted page requested.
optional, string, max chars=70
Type of the requested hosted page.
optional, enumerated stringPossible values are
checkout_newCheckout new Subscription.checkout_existingCheckout existing Subscription.update_payment_methodUpdate Payment Method for a Customer.manage_payment_sourcesManage Payments for a customer.collect_nowCollect Unpaid Invoices for a Customer.extend_subscriptionTo extend a Subscription period.checkout_giftCheckout a gift subscription.claim_giftClaim a gift subscription.checkout_one_timeCheckout one time.
Show all values[+]
Unique URL for the hosted page that will be included in your website.
optional, string, max chars=250
Indicating the current state of the hosted page resource.
optional, enumerated string, default=createdPossible values are
createdIndicates the hosted page is just created.requestedIndicates the hosted page is requested by the website.succeededIndicates the hosted page is successfully submitted by the user and response is sent to the return url.cancelledIndicates the page is cancelled by the end user after requesting it.acknowledgedIndicates the succeeded hosted page is acknowledged.
You can pass through any content specific to the hosted page request and get it back after user had submitted the hosted page.
optional, string, max chars=2048
If true then hosted page formatted to be shown in iframe. If false, it is formatted to be shown as a separate page.
Note : For
in-app checkout, default is false.
boolean, default=true
Indicates when this hosted page url is generated.
optional, timestamp(UTC) in seconds
Indicates when this hosted page url will expire. After this, the hosted page cannot be accessed.
optional, timestamp(UTC) in seconds
This attribute will be returned only during retrieve hosted page API call and also the retrieved hosted page resource state should be either in "succeeded" or "cancelled" state.
If hosted page state is "succeeded", then the subscription, customer, card & invoice(optional) resources during checkout can be obtained.
If hosted page is state is "cancelled", then it will be empty i.e no information about checkout.
jsonobject
Timestamp indicating when this hosted page was last updated.
optional, timestamp(UTC) in seconds
Version number of this resource. Each update of this resource results in incremental change of this number.
optional, long
Customer Info (email, first name and last name) given in the checkout page used for tracking abandoned carts.
Learn more.
optional, jsonobject
Hosted page to accept card details from the subscriber and create a new subscription. This is similar to our server to server API Create a Subscription.
When the redirect URL is notified of the result, we would advise you to retrieve the subscription and verify the details.
Related Tutorials
Notes
As mentioned before this behavior is very similar to the create subscription API call. All the web hook events will be fired only after the submission of payment details by the customer and successful creation of subscription.
Any errors related to the payment form that is submitted is handled as a response within the form so that the user is kept informed about the reason for failure to take corrective action.
Sample Request
# checkout a new subscription with customer details.
curl https://{site}.chargebee.com/api/v2/hosted_pages/checkout_new \
-u {site_api_key}:\
-d customer[email]="john@user.com" \
-d customer[first_name]="John" \
-d customer[last_name]="Doe" \
-d customer[locale]="fr-CA" \
-d customer[phone]="+1-949-999-9999" \
-d subscription[plan_id]="no_trial" \
-d billing_address[first_name]="John" \
-d billing_address[last_name]="Doe" \
-d billing_address[line1]="PO Box 9999" \
-d billing_address[city]="Walnut" \
-d billing_address[state]="California" \
-d billing_address[zip]="91789" \
-d billing_address[country]="US"
copy
# checkout a new subscription with customer details.
curl https://{site}.chargebee.com/api/v2/hosted_pages/checkout_new \
-u {site_api_key}:\
-d customer[email]="john@user.com" \
-d customer[first_name]="John" \
-d customer[last_name]="Doe" \
-d customer[locale]="fr-CA" \
-d customer[phone]="+1-949-999-9999" \
-d subscription[plan_id]="no_trial" \
-d billing_address[first_name]="John" \
-d billing_address[last_name]="Doe" \
-d billing_address[line1]="PO Box 9999" \
-d billing_address[city]="Walnut" \
-d billing_address[state]="California" \
-d billing_address[zip]="91789" \
-d billing_address[country]="US"
# checkout a new subscription with addons.
curl https://{site}.chargebee.com/api/v2/hosted_pages/checkout_new \
-u {site_api_key}:\
-d customer[email]="john@user.com" \
-d customer[first_name]="John" \
-d customer[last_name]="Doe" \
-d customer[locale]="fr-CA" \
-d customer[phone]="+1-949-999-9999" \
-d subscription[plan_id]="no_trial" \
-d addons[id][0]="sub_monitor" \
-d addons[unit_price][0]=100 \
-d addons[quantity][0]=2
# checkout a new subscription with customer card details.
curl https://{site}.chargebee.com/api/v2/hosted_pages/checkout_new \
-u {site_api_key}:\
-d customer[email]="john@user.com" \
-d customer[first_name]="John" \
-d customer[last_name]="Doe" \
-d customer[locale]="fr-CA" \
-d customer[phone]="+1-949-999-9999" \
-d subscription[plan_id]="no_trial" \
-d card[gateway_account_id]="gw___test__KyVnGlSBWmAIk2Ph"
Sample Response [ JSON ]
Show more...
{"hosted_page": {
"created_at": 1517505996,
"embed": true,
"expires_at": 1517509596,
"id": "__test__znukwBn17fojRqcSm5uZtxxn99WgF5gcu",
"object": "hosted_page",
"resource_version": 1517505996000,
"state": "created",
"type": "checkout_new",
"updated_at": 1517505996,
"url": "https://yourapp.chargebee.com/pages/v2/__test__znukwBn17fojRqcSm5uZtxxn99WgF5gcu/checkout"
}}
Show more...
{"hosted_page": {
"created_at": 1517506000,
"embed": true,
"expires_at": 1517509600,
"id": "__test__PnEJ6KNB31zqS76BCwfZs4OCoag4ecjA",
"object": "hosted_page",
"resource_version": 1517506000000,
"state": "created",
"type": "checkout_new",
"updated_at": 1517506000,
"url": "https://yourapp.chargebee.com/pages/v2/__test__PnEJ6KNB31zqS76BCwfZs4OCoag4ecjA/checkout"
}}
Show more...
{"hosted_page": {
"created_at": 1517505999,
"embed": true,
"expires_at": 1517509599,
"id": "__test__oPHcd2RuF4jrRJ0yW7U6akQHKgOuiV8OB",
"object": "hosted_page",
"resource_version": 1517505999000,
"state": "created",
"type": "checkout_new",
"updated_at": 1517505999,
"url": "https://yourapp.chargebee.com/pages/v2/__test__oPHcd2RuF4jrRJ0yW7U6akQHKgOuiV8OB/checkout"
}}
URL Format POST
https://{site}.chargebee.com/api/v2/hosted_pages/checkout_new
Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled.
optional, integer, min=0
mandatory_addons_to_remove[0..n]
List of addons IDs that are mandatory to the plan and has to be removed from the subscription.
optional, list of string
The number of subscription billing cycles (including the first one) to
invoice in advance.
optional, integer, min=1
Override the
billing alignment mode for Calendar Billing. Only applicable when using Calendar Billing. The default value is that which has been configured for the site.
optional, enumerated stringPossible values are
immediateSubscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly..delayedSubscription period will be aligned with the configured billing date at the next renewal.
List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes.
optional, list of string
The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL.
Note :
- Redirect URL configured in Settings > Hosted Pages Settings would be overriden by this redirect URL.
Eg : http://yoursite.com?id=<hosted_page_id>&state=succeeded - This parameter is not applicable for iframe messaging.
optional, string, max chars=250
The customers will be redirected to this URL upon canceling checkout. The hosted page id and state will be passed as parameters to this URL.
Note :
- Cancel URL configured in Settings > Hosted Pages Settings would be overriden by this cancel URL.
Eg : http://yoursite.com?id=<hosted_page_id>&state=cancelled - This parameter is not applicable for iframe messaging and in-app checkout.
optional, string, max chars=250
You can pass through any content specific to the hosted page request and get it back after user had submitted the hosted page.
optional, string, max chars=2048
If true then hosted page formatted to be shown in iframe. If false, it is formatted to be shown as a separate page.
Note : For
in-app checkout, default is false.
optional, boolean, default=true
If true then iframe will communicate with the parent window. Applicable only for embedded(iframe) hosted pages. If you're using iframe_messaging you need to implement onSuccess & onCancel callbacks.
Note : This parameter is not applicable for
in-app checkout.
optional, boolean, default=false
allow_offline_payment_methods
Allow the customer to select an offline payment method during checkout. The choice of payment methods can be configured via the Chargebee UI.
optional, boolean
Parameters for subscription
pass parameters as subscription[<param name>]
A unique and immutable identifier for the subscription. If not provided, it is autogenerated.
optional, string, max chars=50
subscription[plan_unit_price_in_decimal]
When
price overriding is enabled for the site, the price or per-unit price of the plan can be set here. The value
set for the plan is used by default. Provide the value as a decimal string in major units of the currency. Can be provided only when
multi-decimal pricing is enabled.
optional, string, max chars=33
subscription[plan_quantity_in_decimal]
The decimal representation of the quantity of the plan purchased. Can be provided for quantity-based plans and only when
multi-decimal pricing is enabled.
optional, string, max chars=33
Identifier of the plan for this subscription.
required, string, max chars=100
subscription[plan_quantity]
Plan quantity for this subscription.
optional, integer, default=1, min=1
subscription[plan_unit_price]
Amount that will override the Plan's default price.
optional, in cents, min=0
Amount that will override the default setup fee.
optional, in cents, min=0
The time at which the trial ends for this subscription. Can be specified to override the default trial period.If '0' is passed, the subscription will be activated immediately.
optional, timestamp(UTC) in seconds
The date/time at which the subscription is to start or has started. If not provided, the subscription starts immediately. If set to a value in the past then that date/time should not be more than a plan billing period into the past.
optional, timestamp(UTC) in seconds
subscription[auto_collection]
Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property.
optional, enumerated stringPossible values are
onWhenever an invoice is created for this subscription, an automatic charge will be attempted on the payment method available.offAutomatic collection of charges will not be made for this subscription. Use this for offline payments.
subscription[offline_payment_method]
The preferred offline payment method for the subscription.
optional, enumerated stringPossible values are
no_preferenceNo Preference.cashCash.checkCheck.bank_transferBank Transfer.ach_creditACH Credit.sepa_creditSEPA Credit.
subscription[invoice_notes]
Notes to be added to any invoice for this subscription.
optional, string, max chars=2000
subscription[affiliate_token]
A unique tracking token.
optional, string, max chars=250
subscription[contract_term_billing_cycle_on_renewal]
Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as
billing_cycles
or a custom value depending on the
site configuration.
optional, integer, min=1, max=100
Parameters for customer
pass parameters as customer[<param name>]
Id for the new customer. If not given, this will be same as the subscription id.
optional, string, max chars=50
Email of the customer. Configured email notifications will be sent to this email.
optional, string, max chars=70
First name of the customer. If not provided it will be got from contact information entered in the hosted page .
optional, string, max chars=150
Last name of the customer. If not provided it will be got from contact information entered in the hosted page .
optional, string, max chars=150
Company name of the customer.
optional, string, max chars=250
Specifies if the customer is liable for tax.
optional, enumerated string, default=taxablePossible values are
taxableComputes tax for the customer based on the site configuration. In some cases, depending on the region, shipping_address is needed. If not provided, then billing_address is used to compute tax. If that’s not available either, the tax is taken as zero.exempt- Customer is exempted from tax. When using Chargebee’s native Taxes feature or when using the TaxJar integration, no other action is needed.
- However, when using our Avalara integration, optionally, specify
entity_code
or exempt_number
attributes if you use Chargebee’s AvaTax for Sales or specify exemption_details
attribute if you use Chargebee’s AvaTax for Communications integration. Tax may still be applied by Avalara for certain values of entity_code
/exempt_number
/exemption_details
based on the state/region/province of the taxable address.
.
Determines which region-specific language Chargebee uses to communicate with the customer. In the absence of the locale attribute, Chargebee will use your site's default language for customer communication.
optional, string, max chars=50
Phone number of the customer.
optional, string, max chars=50
VAT/ Tax registration number of the customer.
Learn more.
optional, string, max chars=20
customer[consolidated_invoicing]
Applicable when consolidated invoicing is enabled. Indicates whether invoice consolidation should happen during subscription renewals. Needs to be set only if this value is different from the defaults configured.
optional, boolean
Parameters for card
pass parameters as card[<param name>]
The gateway account in which this payment source is stored.
optional, string, max chars=50
Parameters for billing_address
pass parameters as billing_address[<param name>]
billing_address[first_name]
The first name of the billing contact.
optional, string, max chars=150
billing_address[last_name]
The last name of the billing contact.
optional, string, max chars=150
The email address.
optional, string, max chars=70
The company name.
optional, string, max chars=250
The phone number.
optional, string, max chars=50
Address line 1.
optional, string, max chars=150
Address line 2.
optional, string, max chars=150
Address line 3.
optional, string, max chars=150
The name of the city.
optional, string, max chars=50
billing_address[state_code]
The
ISO 3166-2 state/province code without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set
state_code
as
AZ
(not
US-AZ
). For Tamil Nadu (India), set as
TN
(not
IN-TN
). For British Columbia (Canada), set as
BC
(not
CA-BC
).
optional, string, max chars=50
The state/province name. Is set by Chargebee automatically for US, Canada and India If state_code
is provided.
optional, string, max chars=50
Zip or Postal code.
optional, string, max chars=20
billing_address[validation_status]
The address verification status.
optional, enumerated string, default=not_validatedPossible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validAddress is verified but only partially.invalidAddress is invalid.
Parameters for shipping_address
pass parameters as shipping_address[<param name>]
shipping_address[first_name]
The first name of the contact.
optional, string, max chars=150
shipping_address[last_name]
The last name of the contact.
optional, string, max chars=150
The email address.
optional, string, max chars=70
shipping_address[company]
The company name.
optional, string, max chars=250
The phone number.
optional, string, max chars=50
Address line 1.
optional, string, max chars=180
Address line 2.
optional, string, max chars=150
Address line 3.
optional, string, max chars=150
The name of the city.
optional, string, max chars=50
shipping_address[state_code]
The
ISO 3166-2 state/province code without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set
state_code
as
AZ
(not
US-AZ
). For Tamil Nadu (India), set as
TN
(not
IN-TN
). For British Columbia (Canada), set as
BC
(not
CA-BC
).
optional, string, max chars=50
The state/province name. Is set by Chargebee automatically for US, Canada and India If state_code
is provided.
optional, string, max chars=50
Zip or Postal code.
optional, string, max chars=20
shipping_address[country]
shipping_address[validation_status]
The address verification status.
optional, enumerated string, default=not_validatedPossible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validAddress is verified but only partially.invalidAddress is invalid.
Parameters for contract_term
pass parameters as contract_term[<param name>]
contract_term[action_at_term_end]
Action to be taken when the contract term completes.
optional, enumerated string, default=cancelPossible values are
renewContract term completes and a new contract term is started for the number of billing cycles specified in contract_billing_cycle_on_renewal
.The action_at_term_end
for the new contract term is set to renew
.evergreenContract term completes and the subscription renews.cancelContract term completes and subscription is canceled.
contract_term[cancellation_cutoff_period]
The number of days before
contract_end
, during which the customer is barred from canceling the contract term. The customer is allowed to cancel the contract term via the Self-Serve Portal only before this period. This allows you to have sufficient time for processing the contract term closure.
optional, integer, default=0
Parameters for addons. Multiple addons can be passed by specifying unique indices.
pass parameters as addons[<param name>][<idx:0..n>]
Identifier of the addon. Multiple addons can be passed.
optional, string, max chars=100
Addon quantity. Applicable only for the quantity based addons. Should be passed with the same index as that of associated addon id.
optional, integer, default=1, min=1
addons[quantity_in_decimal][0..n]
The decimal representation of the quantity of the addon. Can be provided for quantity-based addons and only when
multi-decimal pricing is enabled.
optional, string, max chars=33
Amount that will override the Addon's default price. The Plan's billing frequency will not be considered for overriding. E.g. If the Plan's billing frequency is every 3 months, and if the price override amount is $10, $10 will be used, and not $30 (i.e $10*3).
optional, in cents, min=0
addons[unit_price_in_decimal][0..n]
When
price overriding is enabled for the site, the price or per-unit price of the addon can be set here. The value
set for the addon is used by default. However, the price provided here is considered as the price of the addon for an entire billing cycle of the subscription regardless of the value of the addon
period
. Provide the value as a decimal string in major units of the currency. Can be provided only when
multi-decimal pricing is enabled.
optional, string, max chars=33
addons[billing_cycles][0..n]
Number of billing cycles the addon will be charged for. When not set, the addon is attached to the subscription for an indefinite number of billing cycles. While updating a subscription to a plan with a different billing period, set this parameter again or its value will be lost. And so, the addon will be attached indefinitely.
optional, integer, min=1
Parameters for event_based_addons. Multiple event_based_addons can be passed by specifying unique indices.
pass parameters as event_based_addons[<param name>][<idx:0..n>]
event_based_addons[id][0..n]
A unique 'id' used to identify the addon.
optional, string, max chars=100
event_based_addons[quantity][0..n]
Addon quantity. Applicable only for the quantity based addons. Should be passed with the same index as that of associated addon id.
optional, integer, min=0
event_based_addons[unit_price][0..n]
Amount that will override the Addon's default price.
optional, in cents, min=0
event_based_addons[quantity_in_decimal][0..n]
The decimal representation of the quantity of the addon. Can be provided for quantity-based addons and only when
multi-decimal pricing is enabled.
optional, string, max chars=33
event_based_addons[unit_price_in_decimal][0..n]
When
price overriding is enabled for the site, the price or per-unit price of the addon can be set here. The value
set for the addon is used by default. Provide the value as a decimal string in major units of the currency. Can be provided only when
multi-decimal pricing is enabled.
optional, string, max chars=33
event_based_addons[service_period_in_days][0..n]
Defines service period of the addon in days from the day of charge.
optional, integer, min=1, max=730
event_based_addons[on_event][0..n]
Event on which this addon will be charged.
optional, enumerated stringPossible values are
subscription_creationAddon will be charged on subscription creation.subscription_trial_startAddon will be charged when the trial period starts.plan_activationAddon will be charged on plan activation.subscription_activationAddon will be charged on subscription activation.contract_terminationAddon will be charged on contract termination.
event_based_addons[charge_once][0..n]
If enabled, the addon will be charged only at the first occurrence of the event. Applicable only for non-recurring add-ons.
optional, boolean, default=true
event_based_addons[charge_on][0..n]
Indicates when the non-recurring addon will be charged.
optional, enumerated stringPossible values are
immediatelyCharges for the addon will be applied immediately.on_eventCharge for the addon will be applied on the occurrence of a specified event.
Resource object representing hosted_page.
always returned
Create a Chargebee hosted page to accept payment from a customer and checkout non-recurring addons and one-time charges.
The following steps describe how best to use this API:
- Call this endpoint, providing non-recurring addons, one-time charges, coupons and a host of other details such as billing and shipping addresses of the customer, to be prefilled on the checkout page.
- Send the customer to the Checkout
url
received in the response.
- Once they complete checkout, the non-recurring addons and one-time charges are automatically invoiced against the respective
customer
record in Chargebee, and they are redirected to the redirect_url
with the id
and state
attributes passed as query string parameters.
- Retrieve the hosted page at this stage to get the invoice details.
Sample Request
# Creates a checkout with non-recurring addon
curl https://{site}.chargebee.com/api/v2/hosted_pages/checkout_one_time \
-u {site_api_key}:\
-d customer[id]="__test__3Nl7Oe7SJWjx905b" \
-d addons[id][0]="non_recurring_addon" \
-d addons[unit_price][0]=2000 \
-d addons[quantity][0]=2 \
-d billing_address[first_name]="John" \
-d billing_address[last_name]="Doe" \
-d billing_address[line1]="PO Box 9999" \
-d billing_address[city]="Walnut" \
-d billing_address[state]="California" \
-d billing_address[zip]="91789" \
-d billing_address[country]="US" \
-d shipping_address[first_name]="John" \
-d shipping_address[last_name]="Mathew" \
-d shipping_address[city]="Walnut" \
-d shipping_address[state]="California" \
-d shipping_address[zip]="91789" \
-d shipping_address[country]="US"
copy
# Creates a checkout with non-recurring addon
curl https://{site}.chargebee.com/api/v2/hosted_pages/checkout_one_time \
-u {site_api_key}:\
-d customer[id]="__test__3Nl7Oe7SJWjx905b" \
-d addons[id][0]="non_recurring_addon" \
-d addons[unit_price][0]=2000 \
-d addons[quantity][0]=2 \
-d billing_address[first_name]="John" \
-d billing_address[last_name]="Doe" \
-d billing_address[line1]="PO Box 9999" \
-d billing_address[city]="Walnut" \
-d billing_address[state]="California" \
-d billing_address[zip]="91789" \
-d billing_address[country]="US" \
-d shipping_address[first_name]="John" \
-d shipping_address[last_name]="Mathew" \
-d shipping_address[city]="Walnut" \
-d shipping_address[state]="California" \
-d shipping_address[zip]="91789" \
-d shipping_address[country]="US"
# Creates a checkout with one-time charge
curl https://{site}.chargebee.com/api/v2/hosted_pages/checkout_one_time \
-u {site_api_key}:\
-d customer[id]="__test__3Nl7Oe7SJWjxt75r" \
-d charges[amount][0]=1000 \
-d charges[description][0]="Support Charge"
# Creates a checkout with non-recurring addon and one-time charge
curl https://{site}.chargebee.com/api/v2/hosted_pages/checkout_one_time \
-u {site_api_key}:\
-d customer[id]="__test__3Nl7Oe7SJWjxX15j" \
-d addons[id][0]="non_recurring_addon" \
-d addons[unit_price][0]=2000 \
-d addons[quantity][0]=2 \
-d charges[amount][0]=1000 \
-d charges[description][0]="Support Charge"
Sample Response [ JSON ]
Show more...
{"hosted_page": {
"created_at": 1517490515,
"embed": false,
"expires_at": 1517494115,
"id": "__one_time_checkout___test__ndXKBDiEMD5gWNAHT2FC8FpfdWjRJ60c",
"object": "hosted_page",
"resource_version": 1517490515264,
"state": "created",
"type": "checkout_one_time",
"updated_at": 1517490515,
"url": "https://yourapp.chargebee.com/pages/v3/__one_time_checkout___test__ndXKBDiEMD5gWNAHT2FC8FpfdWjRJ60c/"
}}
Show more...
{"hosted_page": {
"created_at": 1517490517,
"embed": false,
"expires_at": 1517494117,
"id": "__one_time_checkout___test__cdp2X2Mcd1KVekorXqI7LemaGacuZfc3klU",
"object": "hosted_page",
"resource_version": 1517490518015,
"state": "created",
"type": "checkout_one_time",
"updated_at": 1517490518,
"url": "https://yourapp.chargebee.com/pages/v3/__one_time_checkout___test__cdp2X2Mcd1KVekorXqI7LemaGacuZfc3klU/"
}}
Show more...
{"hosted_page": {
"created_at": 1517490516,
"embed": false,
"expires_at": 1517494116,
"id": "__one_time_checkout___test__RrskcdKPskXT8MIZnccuar99DcuXUyY5eZ6",
"object": "hosted_page",
"resource_version": 1517490516676,
"state": "created",
"type": "checkout_one_time",
"updated_at": 1517490516,
"url": "https://yourapp.chargebee.com/pages/v3/__one_time_checkout___test__RrskcdKPskXT8MIZnccuar99DcuXUyY5eZ6/"
}}
URL Format POST
https://{site}.chargebee.com/api/v2/hosted_pages/checkout_one_time
The currency code (ISO 4217 format) of the invoice amount.
required if Multicurrency is enabled, string, max chars=3
Identifier of the coupon as a List. Coupon Codes can also be passed.
optional, list of string
The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL.
Note :
- Redirect URL configured in Settings > Hosted Pages Settings would be overriden by this redirect URL.
Eg : http://yoursite.com?id=<hosted_page_id>&state=succeeded - This parameter is not applicable for iframe messaging.
optional, string, max chars=250
The customers will be redirected to this URL upon canceling checkout. The hosted page id and state will be passed as parameters to this URL.
Note :
- Cancel URL configured in Settings > Hosted Pages Settings would be overriden by this cancel URL.
Eg : http://yoursite.com?id=<hosted_page_id>&state=cancelled - This parameter is not applicable for iframe messaging and in-app checkout.
optional, string, max chars=250
You can pass through any content specific to the hosted page request and get it back after user had submitted the hosted page.
optional, string, max chars=2048
If true then hosted page formatted to be shown in iframe. If false, it is formatted to be shown as a separate page.
Note : For
in-app checkout, default is false.
optional, boolean, default=true
If true then iframe will communicate with the parent window. Applicable only for embedded(iframe) hosted pages. If you're using iframe_messaging you need to implement onSuccess & onCancel callbacks.
Note : This parameter is not applicable for
in-app checkout.
optional, boolean, default=false
Parameters for customer
pass parameters as customer[<param name>]
Id for the new customer. If not given, this will be same as the subscription id.
optional, string, max chars=50
Email of the customer. Configured email notifications will be sent to this email.
optional, string, max chars=70
First name of the customer. If not provided it will be got from contact information entered in the hosted page .
optional, string, max chars=150
Last name of the customer. If not provided it will be got from contact information entered in the hosted page .
optional, string, max chars=150
Company name of the customer.
optional, string, max chars=250
Specifies if the customer is liable for tax.
optional, enumerated string, default=taxablePossible values are
taxableComputes tax for the customer based on the site configuration. In some cases, depending on the region, shipping_address is needed. If not provided, then billing_address is used to compute tax. If that’s not available either, the tax is taken as zero.exempt- Customer is exempted from tax. When using Chargebee’s native Taxes feature or when using the TaxJar integration, no other action is needed.
- However, when using our Avalara integration, optionally, specify
entity_code
or exempt_number
attributes if you use Chargebee’s AvaTax for Sales or specify exemption_details
attribute if you use Chargebee’s AvaTax for Communications integration. Tax may still be applied by Avalara for certain values of entity_code
/exempt_number
/exemption_details
based on the state/region/province of the taxable address.
.
Determines which region-specific language Chargebee uses to communicate with the customer. In the absence of the locale attribute, Chargebee will use your site's default language for customer communication.
optional, string, max chars=50
Phone number of the customer.
optional, string, max chars=50
VAT/ Tax registration number of the customer.
Learn more.
optional, string, max chars=20
customer[consolidated_invoicing]
Applicable when consolidated invoicing is enabled. Indicates whether invoice consolidation should happen during subscription renewals. Needs to be set only if this value is different from the defaults configured.
optional, boolean
Parameters for invoice
pass parameters as invoice[<param name>]
Purchase Order Number for this invoice.
optional, string, max chars=100
Parameters for card
pass parameters as card[<param name>]
The gateway account in which this payment source is stored.
optional, string, max chars=50
Parameters for billing_address
pass parameters as billing_address[<param name>]
billing_address[first_name]
The first name of the billing contact.
optional, string, max chars=150
billing_address[last_name]
The last name of the billing contact.
optional, string, max chars=150
The email address.
optional, string, max chars=70
The company name.
optional, string, max chars=250
The phone number.
optional, string, max chars=50
Address line 1.
optional, string, max chars=150
Address line 2.
optional, string, max chars=150
Address line 3.
optional, string, max chars=150
The name of the city.
optional, string, max chars=50
billing_address[state_code]
The
ISO 3166-2 state/province code without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set
state_code
as
AZ
(not
US-AZ
). For Tamil Nadu (India), set as
TN
(not
IN-TN
). For British Columbia (Canada), set as
BC
(not
CA-BC
).
optional, string, max chars=50
The state/province name. Is set by Chargebee automatically for US, Canada and India If state_code
is provided.
optional, string, max chars=50
Zip or Postal code.
optional, string, max chars=20
billing_address[validation_status]
The address verification status.
optional, enumerated string, default=not_validatedPossible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validAddress is verified but only partially.invalidAddress is invalid.
Parameters for shipping_address
pass parameters as shipping_address[<param name>]
shipping_address[first_name]
The first name of the contact.
optional, string, max chars=150
shipping_address[last_name]
The last name of the contact.
optional, string, max chars=150
The email address.
optional, string, max chars=70
shipping_address[company]
The company name.
optional, string, max chars=250
The phone number.
optional, string, max chars=50
Address line 1.
optional, string, max chars=180
Address line 2.
optional, string, max chars=150
Address line 3.
optional, string, max chars=150
The name of the city.
optional, string, max chars=50
shipping_address[state_code]
The
ISO 3166-2 state/province code without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set
state_code
as
AZ
(not
US-AZ
). For Tamil Nadu (India), set as
TN
(not
IN-TN
). For British Columbia (Canada), set as
BC
(not
CA-BC
).
optional, string, max chars=50
The state/province name. Is set by Chargebee automatically for US, Canada and India If state_code
is provided.
optional, string, max chars=50
Zip or Postal code.
optional, string, max chars=20
shipping_address[country]
shipping_address[validation_status]
The address verification status.
optional, enumerated string, default=not_validatedPossible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validAddress is verified but only partially.invalidAddress is invalid.
Parameters for addons. Multiple addons can be passed by specifying unique indices.
pass parameters as addons[<param name>][<idx:0..n>]
Identifier of the addon. Multiple addons can be passed.
optional, string, max chars=100
Addon quantity. Applicable only for the quantity based addons. Should be passed with the same index as that of associated addon id.
optional, integer, default=1, min=1
Amount that will override the Addon's default price. The Plan's billing frequency will not be considered for overriding. E.g. If the Plan's billing frequency is every 3 months, and if the price override amount is $10, $10 will be used, and not $30 (i.e $10*3).
optional, in cents, min=0
addons[quantity_in_decimal][0..n]
The decimal representation of the quantity of the
non-recurring addon. Provide the value in major units of the currency. Must be provided when the addon is quantity-based. This parameter can only be passed when
multi-decimal pricing is enabled.
optional, string, max chars=33
addons[unit_price_in_decimal][0..n]
The time when the service period for the addon starts.
optional, timestamp(UTC) in seconds
The time when the service period for the addon ends.
optional, timestamp(UTC) in seconds
Parameters for charges. Multiple charges can be passed by specifying unique indices.
pass parameters as charges[<param name>][<idx:0..n>]
The amount to be charged.
optional, in cents, min=1
charges[amount_in_decimal][0..n]
The decimal representation of the amount for the
one-time charge. Provide the value in major units of the currency. Can be provided only when
multi-decimal pricing is enabled.
optional, string, max chars=33
charges[description][0..n]
Description for this charge.
optional, string, max chars=250
charges[avalara_sale_type][0..n]
Indicates the type of sale carried out. This is applicable only if you use
Chargebee’s AvaTax for Communications integration.
optional, enumerated stringPossible values are
wholesaleTransaction is a sale to another company that will resell your product or service to another consumer.retailTransaction is a sale to an end user.consumedTransaction is for an item that is consumed directly.vendor_useTransaction is for an item that is subject to vendor use tax.
charges[avalara_transaction_type][0..n]
Indicates the type of product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use
Chargebee’s AvaTax for Communications integration.
optional, integer
charges[avalara_service_type][0..n]
Indicates the type of service for the product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use
Chargebee’s AvaTax for Communications integration.
optional, integer
The time when the service period for the charge starts.
optional, timestamp(UTC) in seconds
The time when the service period for the charge ends.
optional, timestamp(UTC) in seconds
Resource object representing hosted_page.
always returned
You can checkout an existing subscription(typically in the trial state) by passing in the plan, quantity and addon details(like Update a Subscription)
When the redirect URL is notified of the result, we would advise you to retrieve the subscription and verify the details.
Related Tutorial
Notes
As mentioned before this behavior is very similar to the update subscription API call. All the web hook events will be fired only after the submission of payment details by the customer and successful checkout of subscription.
Any errors related to the payment form that is submitted is handled as a response within the form so that the user is kept informed about the reason for failure to take corrective action.
Sample Request
curl https://{site}.chargebee.com/api/v2/hosted_pages/checkout_existing \
-u {site_api_key}:\
-d subscription[id]="__test__KyVnHhSBWmCOu2tC" \
-d subscription[plan_id]="sub_plan1"
copy
curl https://{site}.chargebee.com/api/v2/hosted_pages/checkout_existing \
-u {site_api_key}:\
-d subscription[id]="__test__KyVnHhSBWmCOu2tC" \
-d subscription[plan_id]="sub_plan1"
# checkout an existing subscription with addons.
curl https://{site}.chargebee.com/api/v2/hosted_pages/checkout_existing \
-u {site_api_key}:\
-d subscription[id]="__test__KyVnHhSBWmCoF2tJ" \
-d subscription[plan_id]="no_trial" \
-d addons[id][0]="sub_ssl" \
-d addons[unit_price][0]=200
Sample Response [ JSON ]
Show more...
{"hosted_page": {
"created_at": 1517505988,
"embed": true,
"expires_at": 1517509588,
"id": "__test__yY8QV6GaiRmIYi3JV6ZBHulNfEVj6LjG",
"object": "hosted_page",
"resource_version": 1517505988000,
"state": "created",
"type": "checkout_existing",
"updated_at": 1517505988,
"url": "https://yourapp.chargebee.com/pages/v2/__test__yY8QV6GaiRmIYi3JV6ZBHulNfEVj6LjG/checkout"
}}
Show more...
{"hosted_page": {
"created_at": 1517505989,
"embed": true,
"expires_at": 1517509589,
"id": "__test__7HSjiTQGqB7Bg3wHdjHRWZKu0Pcda4mcd0",
"object": "hosted_page",
"resource_version": 1517505989000,
"state": "created",
"type": "checkout_existing",
"updated_at": 1517505989,
"url": "https://yourapp.chargebee.com/pages/v2/__test__7HSjiTQGqB7Bg3wHdjHRWZKu0Pcda4mcd0/checkout"
}}
URL Format POST
https://{site}.chargebee.com/api/v2/hosted_pages/checkout_existing
Should be true if the existing addons should be replaced with the ones that are being passed.
optional, boolean
mandatory_addons_to_remove[0..n]
List of addons IDs that are mandatory to the plan and has to be removed from the subscription.
optional, list of string
The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles set for the plan is used. For Product Catalog v2, billing cycles set for plan-item price is used by default.
optional, integer, min=0
The number of subscription billing cycles to
invoice in advance. If a new term is started for the subscription due to this API call, then
terms_to_charge
is inclusive of this new term. See description for the
force_term_reset
parameter to learn more about when a subscription term is reset.
optional, integer, min=1
When the subscription is reactivated as described under the reactivate
parameter, this is the date/time at which the subscription should be reactivated.
optional, timestamp(UTC) in seconds
Override the
billing alignment mode chosen for the site for calendar billing. Only applicable when using calendar billing.
optional, enumerated stringPossible values are
immediateSubscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly..delayedSubscription period will be aligned with the configured billing date at the next renewal.
List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes.
optional, list of string
Applicable only for cancelled subscriptions. Once this is passed as true, cancelled subscription will become active; otherwise subscription changes will be made but the the subscription state will remain cancelled. If not passed, subscription will be activated only if there is any change in subscription data.
optional, boolean
Applicable for 'Active' & 'Non Renewing' states alone. Generally, subscription's term will be reset (i.e current term is ended and a new term starts immediately) when a new plan having different billing frequency is specified in the input. For all the other cases, the subscription's term will remain intact. Now for this later scenario, if you want to force a term reset you can specify this param as 'true'. Note: Specifying this value as 'false' has no impact on the default behaviour.
optional, boolean, default=false
The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL.
Note :
- Redirect URL configured in Settings > Hosted Pages Settings would be overriden by this redirect URL.
Eg : http://yoursite.com?id=<hosted_page_id>&state=succeeded - This parameter is not applicable for iframe messaging.
optional, string, max chars=250
The customers will be redirected to this URL upon canceling checkout. The hosted page id and state will be passed as parameters to this URL.
Note :
- Cancel URL configured in Settings > Hosted Pages Settings would be overriden by this cancel URL.
Eg : http://yoursite.com?id=<hosted_page_id>&state=cancelled - This parameter is not applicable for iframe messaging and in-app checkout.
optional, string, max chars=250
You can pass through any content specific to the hosted page request and get it back after user had submitted the hosted page.
optional, string, max chars=2048
If true then hosted page formatted to be shown in iframe. If false, it is formatted to be shown as a separate page.
Note : For
in-app checkout, default is false.
optional, boolean, default=true
If true then iframe will communicate with the parent window. Applicable only for embedded(iframe) hosted pages. If you're using iframe_messaging you need to implement onSuccess & onCancel callbacks.
Note : This parameter is not applicable for
in-app checkout.
optional, boolean, default=false
allow_offline_payment_methods
Allow the customer to select an offline payment method during checkout. The choice of payment methods can be configured via the Chargebee UI.
optional, boolean
Parameters for subscription
pass parameters as subscription[<param name>]
A unique and immutable identifier for the subscription. If not provided, it is autogenerated.
required, string, max chars=50
Identifier of the plan for this subscription.
optional, string, max chars=100
subscription[plan_quantity]
Represents the plan quantity for this subscription.
optional, integer, min=1
subscription[plan_unit_price]
Amount that will override the Plan's default price.
optional, in cents, min=0
Amount that will override the default setup fee.
optional, in cents, min=0
subscription[plan_quantity_in_decimal]
The decimal representation of the quantity of the plan purchased. Can be provided for quantity-based plans and only when
multi-decimal pricing is enabled.
optional, string, max chars=33
subscription[plan_unit_price_in_decimal]
When price overriding is enabled for the site, the price or per-unit price of the plan can be set here. The value
set for the plan is used by default. Provide the value as a decimal string in major units of the currency. Can be provided only when
multi-decimal pricing is enabled.
optional, string, max chars=33
The new start date of a future
subscription. Applicable only for future
subscriptions.
optional, timestamp(UTC) in seconds
End of the trial period for the subscription. This overrides the trial period set for the plan. In Product Catalog v2 this overrides trial period set for the plan-item. Set it to 0
to have no trial period.
optional, timestamp(UTC) in seconds
subscription[auto_collection]
Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property.
optional, enumerated stringPossible values are
onWhenever an invoice is created for this subscription, an automatic charge will be attempted on the payment method available.offAutomatic collection of charges will not be made for this subscription. Use this for offline payments.
subscription[offline_payment_method]
The preferred offline payment method for the subscription.
optional, enumerated stringPossible values are
no_preferenceNo Preference.cashCash.checkCheck.bank_transferBank Transfer.ach_creditACH Credit.sepa_creditSEPA Credit.
subscription[invoice_notes]
Notes to be added to any invoice for this subscription.
optional, string, max chars=2000
subscription[contract_term_billing_cycle_on_renewal]
Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as
billing_cycles
or a custom value depending on the
site configuration.
optional, integer, min=1, max=100
Parameters for customer
pass parameters as customer[<param name>]
VAT/ Tax registration number of the customer.
Learn more.
optional, string, max chars=20
Parameters for card
pass parameters as card[<param name>]
The gateway account in which this payment source is stored.
optional, string, max chars=50
Parameters for contract_term
pass parameters as contract_term[<param name>]
contract_term[action_at_term_end]
Action to be taken when the contract term completes.
optional, enumerated string, default=cancelPossible values are
renewContract term completes and a new contract term is started for the number of billing cycles specified in contract_billing_cycle_on_renewal
.The action_at_term_end
for the new contract term is set to renew
.evergreenContract term completes and the subscription renews.cancelContract term completes and subscription is canceled.
contract_term[cancellation_cutoff_period]
The number of days before
contract_end
, during which the customer is barred from canceling the contract term. The customer is allowed to cancel the contract term via the Self-Serve Portal only before this period. This allows you to have sufficient time for processing the contract term closure.
optional, integer, default=0
Parameters for addons. Multiple addons can be passed by specifying unique indices.
pass parameters as addons[<param name>][<idx:0..n>]
Identifier of the addon. Multiple addons can be passed.
optional, string, max chars=100
Addon quantity. Applicable only for the quantity based addons. Should be passed with the same index as that of associated addon id.
optional, integer, min=1
Amount that will override the Addon's default price. The Plan's billing frequency will not be considered for overriding. E.g. If the Plan's billing frequency is every 3 months, and if the price override amount is $10, $10 will be used, and not $30 (i.e $10*3).
optional, in cents, min=0
addons[billing_cycles][0..n]
Number of billing cycles the addon will be charged for. When not set, the addon is attached to the subscription for an indefinite number of billing cycles. While updating a subscription to a plan with a different billing period, set this parameter again or its value will be lost. And so, the addon will be attached indefinitely.
optional, integer, min=1
addons[quantity_in_decimal][0..n]
The decimal representation of the quantity of the addon. Can be provided for quantity-based addons and only when
multi-decimal pricing is enabled.
optional, string, max chars=33
addons[unit_price_in_decimal][0..n]
When
price overriding is enabled for the site, the price or per-unit price of the addon can be set here. The value
set for the addon is used by default. However, the price provided here is considered as the price of the addon for an entire billing cycle of the subscription regardless of the value of the addon
period
. Provide the value as a decimal string in major units of the currency. Can be provided only when
multi-decimal pricing is enabled.
optional, string, max chars=33
Parameters for event_based_addons. Multiple event_based_addons can be passed by specifying unique indices.
pass parameters as event_based_addons[<param name>][<idx:0..n>]
event_based_addons[id][0..n]
A unique 'id' used to identify the addon.
optional, string, max chars=100
event_based_addons[quantity][0..n]
Addon quantity. Applicable only for the quantity based addons. Should be passed with the same index as that of associated addon id.
optional, integer, min=0
event_based_addons[unit_price][0..n]
Amount that will override the Addon's default price.
optional, in cents, min=0
event_based_addons[service_period_in_days][0..n]
Defines service period of the addon in days from the day of charge.
optional, integer, min=1, max=730
event_based_addons[charge_on][0..n]
Indicates when the non-recurring addon will be charged.
optional, enumerated stringPossible values are
immediatelyCharges for the addon will be applied immediately.on_eventCharge for the addon will be applied on the occurrence of a specified event.
event_based_addons[on_event][0..n]
Event on which this addon will be charged.
optional, enumerated stringPossible values are
subscription_creationAddon will be charged on subscription creation.subscription_trial_startAddon will be charged when the trial period starts.plan_activationAddon will be charged on plan activation.subscription_activationAddon will be charged on subscription activation.contract_terminationAddon will be charged on contract termination.
event_based_addons[charge_once][0..n]
If enabled, the addon will be charged only at the first occurrence of the event. Applicable only for non-recurring add-ons.
optional, boolean
event_based_addons[quantity_in_decimal][0..n]
The decimal representation of the quantity of the addon. Can be provided for quantity-based addons and only when
multi-decimal pricing is enabled.
optional, string, max chars=33
event_based_addons[unit_price_in_decimal][0..n]
When
price overriding is enabled for the site, the price or per-unit price of the addon can be set here. The value
set for the addonis used by default. Provide the value as a decimal string in major units of the currency. Can be provided only when
multi-decimal pricing is enabled.
optional, string, max chars=33
Resource object representing hosted_page.
always returned
Note: If you're using Checkout V3, use Manage Payment Sources API to request your customers to update their payment method details or change their payment method.
Using this API, you can request your customers to update their payment method details or change their payment method. This is used in scenarios like customers updating their payment methods before the end of trial or customers switching among payment methods.
When this API is invoked, it returns a hosted page URL. When the customers are directed to this URL, they will be able to change/update their payment methods.
Depending on the payment methods (Card, PayPal Express Checkout, Amazon Payments) that you offer your customers, they will find options to switch among the various methods of payment.
Note:
- If the card[gateway] parameter is passed, and the customer chooses Card as a payment method, then the card details are stored in the gateway which is passed. However, if the card[gateway] parameter is passed and the customer chooses PayPal Express Checkout/Amazon Payments as a payment method, the gateway passed will be ignored.
- The option of embedding into an iframe is not supported for PayPal Express Checkout and Amazon Payments as customers are redirected to the respective website pages. Hence if you have PayPal Express Checkout/Amazon Payments configured and pass the parameter embed=true, this will result in an unsuccessful API request. Also, if you have all the three payment methods (Card, Paypal Express Checkout and Amazon Payments) configured and pass the parameter embed=true, the returned hosted page URL will show only Card Payment as a payment method.
Sample Request
curl https://{site}.chargebee.com/api/v2/hosted_pages/update_payment_method \
-u {site_api_key}:\
-d customer[id]="__test__KyVnHhSBWmKhy2uX" \
-d card[gateway_account_id]="gw___test__KyVnGlSBWmAIk2Ph"
copy
curl https://{site}.chargebee.com/api/v2/hosted_pages/update_payment_method \
-u {site_api_key}:\
-d customer[id]="__test__KyVnHhSBWmKhy2uX" \
-d card[gateway_account_id]="gw___test__KyVnGlSBWmAIk2Ph"
Sample Response [ JSON ]
Show more...
{"hosted_page": {
"created_at": 1517506020,
"embed": true,
"expires_at": 1517592420,
"id": "__test__Rvi8fL7SS0CURBeH2k0CgkPLH6MyU2Sy",
"object": "hosted_page",
"resource_version": 1517506020000,
"state": "created",
"type": "update_payment_method",
"updated_at": 1517506020,
"url": "https://yourapp.chargebee.com/pages/v2/__test__Rvi8fL7SS0CURBeH2k0CgkPLH6MyU2Sy/update_payment_method"
}}
URL Format POST
https://{site}.chargebee.com/api/v2/hosted_pages/update_payment_method
The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL.
Note :
- Redirect URL configured in Settings > Hosted Pages Settings would be overriden by this redirect URL.
Eg : http://yoursite.com?id=<hosted_page_id>&state=succeeded - This parameter is not applicable for iframe messaging.
optional, string, max chars=250
The customers will be redirected to this URL upon canceling checkout. The hosted page id and state will be passed as parameters to this URL.
Note :
- Cancel URL configured in Settings > Hosted Pages Settings would be overriden by this cancel URL.
Eg : http://yoursite.com?id=<hosted_page_id>&state=cancelled - This parameter is not applicable for iframe messaging and in-app checkout.
optional, string, max chars=250
You can pass through any content specific to the hosted page request and get it back after user had submitted the hosted page.
optional, string, max chars=2048
If true then hosted page formatted to be shown in iframe. If false, it is formatted to be shown as a separate page.
Note : For
in-app checkout, default is false.
optional, boolean, default=true
If true then iframe will communicate with the parent window. Applicable only for embedded(iframe) hosted pages. If you're using iframe_messaging you need to implement onSuccess & onCancel callbacks.
Note : This parameter is not applicable for
in-app checkout.
optional, boolean, default=false
Parameters for customer
pass parameters as customer[<param name>]
Identifier of the customer.
required, string, max chars=50
Parameters for card
pass parameters as card[<param name>]
The gateway account in which this payment source is stored.
optional, string, max chars=50
Resource object representing hosted_page.
always returned
Sample Request
curl https://{site}.chargebee.com/api/v2/hosted_pages/manage_payment_sources \
-u {site_api_key}:\
-d customer[id]="__test__KyVnHhSBWmJIX2uE" \
-d card[gateway_account_id]="gw___test__KyVnGlSBWmAIk2Ph"
copy
curl https://{site}.chargebee.com/api/v2/hosted_pages/manage_payment_sources \
-u {site_api_key}:\
-d customer[id]="__test__KyVnHhSBWmJIX2uE" \
-d card[gateway_account_id]="gw___test__KyVnGlSBWmAIk2Ph"
Sample Response [ JSON ]
Show more...
{"hosted_page": {
"created_at": 1517506015,
"embed": false,
"expires_at": 1517592415,
"id": "__test__LycuLPCkhW3axOiXjHWkOOVl3ZE3yLLni",
"object": "hosted_page",
"resource_version": 1517506015000,
"state": "created",
"type": "manage_payment_sources",
"updated_at": 1517506015,
"url": "https://yourapp.chargebee.com/pages/v3/__test__LycuLPCkhW3axOiXjHWkOOVl3ZE3yLLni/"
}}
URL Format POST
https://{site}.chargebee.com/api/v2/hosted_pages/manage_payment_sources
URL to redirect after payment method is added.
optional, string, max chars=250
Parameters for customer
pass parameters as customer[<param name>]
Identifier of the customer.
required, string, max chars=50
Parameters for card
pass parameters as card[<param name>]
The gateway account in which this payment source is stored.
optional, string, max chars=50
Resource object representing hosted_page.
always returned
Sample Request
curl https://{site}.chargebee.com/api/v2/hosted_pages/collect_now \
-u {site_api_key}:\
-d customer[id]="__test__KyVnGlSBWmHH82Pw" \
-d card[gateway_account_id]="gw___test__KyVnGlSBWmAIk2Ph"
copy
curl https://{site}.chargebee.com/api/v2/hosted_pages/collect_now \
-u {site_api_key}:\
-d customer[id]="__test__KyVnGlSBWmHH82Pw" \
-d card[gateway_account_id]="gw___test__KyVnGlSBWmAIk2Ph"
Sample Response [ JSON ]
Show more...
{"hosted_page": {
"created_at": 1517506010,
"embed": true,
"expires_at": 1517592410,
"id": "__test__4cq9mwW1cuoD085nSBLh0KUMKdphVO5cC",
"object": "hosted_page",
"resource_version": 1517506010000,
"state": "created",
"type": "collect_now",
"updated_at": 1517506010,
"url": "https://yourapp.chargebee.com/pages/v3/__test__4cq9mwW1cuoD085nSBLh0KUMKdphVO5cC/collect_now"
}}
URL Format POST
https://{site}.chargebee.com/api/v2/hosted_pages/collect_now
URL to redirect after invoices are paid.
optional, string, max chars=250
The currency code (ISO 4217 format) of the specified credit amount.
optional, string, max chars=3
Parameters for customer
pass parameters as customer[<param name>]
Identifier of the customer.
required, string, max chars=50
Parameters for card
pass parameters as card[<param name>]
The gateway account in which this payment source is stored.
optional, string, max chars=50
Resource object representing hosted_page.
always returned
This API generates a hosted page URL for the customer to accept a quote. If the hosted page URL has expired, a new URL will be generated automatically.
Notes
- Hosted page URL to accept a quote cannot be generated for one-time charges.
- Customers with existing subscriptions can generate a quote for new subscriptions. However, Hosted page URL to accept a quote cannot be generated for new subscriptions in V1 and V2 hosted pages.
Sample Request
curl https://{site}.chargebee.com/api/v2/hosted_pages/accept_quote \
-X POST \
-u {site_api_key}:\
-d quote[id]="1"
copy
curl https://{site}.chargebee.com/api/v2/hosted_pages/accept_quote \
-X POST \
-u {site_api_key}:\
-d quote[id]="1"
Sample Response [ JSON ]
Show more...
{"hosted_page": {
"created_at": 1517505980,
"embed": true,
"expires_at": 1517596199,
"id": "__test__IKNpcdSoRFV0hFeci8SSkUbhZYjle2dKh",
"object": "hosted_page",
"resource_version": 1517505981000,
"state": "created",
"type": "checkout_existing",
"updated_at": 1517505981,
"url": "https://yourapp.chargebee.com/pages/v2/__test__IKNpcdSoRFV0hFeci8SSkUbhZYjle2dKh/checkout"
}}
URL Format POST
https://{site}.chargebee.com/api/v2/hosted_pages/accept_quote
The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL.
Note :
- Redirect URL configured in Settings > Hosted Pages Settings would be overriden by this redirect URL.
Eg : http://yoursite.com?id=<hosted_page_id>&state=succeeded - This parameter is not applicable for iframe messaging.
optional, string, max chars=250
Parameters for quote
pass parameters as quote[<param name>]
The quote number. Acts as a identifier for quote and typically generated sequentially.
required, string, max chars=50
Resource object representing hosted_page.
always returned
Sample Request
curl https://{site}.chargebee.com/api/v2/hosted_pages/extend_subscription \
-u {site_api_key}:\
-d subscription[id]="__test__KyVnHhSBWmIgw2u6" \
-d billing_cycle=2 \
-d expiry=14
copy
curl https://{site}.chargebee.com/api/v2/hosted_pages/extend_subscription \
-u {site_api_key}:\
-d subscription[id]="__test__KyVnHhSBWmIgw2u6" \
-d billing_cycle=2 \
-d expiry=14
Sample Response [ JSON ]
Show more...
{"hosted_page": {
"created_at": 1517506012,
"embed": true,
"expires_at": 1518715612,
"id": "__test__Bct8ySC6A1eV2GdMcdUl7dzovgyKhAz4M",
"object": "hosted_page",
"resource_version": 1517506012000,
"state": "created",
"type": "extend_subscription",
"updated_at": 1517506012,
"url": "https://yourapp.chargebee.com/pages/v3/__test__Bct8ySC6A1eV2GdMcdUl7dzovgyKhAz4M/"
}}
URL Format POST
https://{site}.chargebee.com/api/v2/hosted_pages/extend_subscription
Expiry (in days) for the link generated. No expiry will be set if this is not specified.
optional, integer, min=1, max=500
Number of billing cycles to extend. If not specified, plan's billing cycle will be used.
optional, integer, min=1
Parameters for subscription
pass parameters as subscription[<param name>]
A unique and immutable identifier for the subscription. If not provided, it is autogenerated.
required, string, max chars=50
Resource object representing hosted_page.
always returned
Sample Request
curl https://{site}.chargebee.com/api/v2/hosted_pages/checkout_gift \
-u {site_api_key}:\
-d subscription[plan_id]="GiftPlan$100"
copy
curl https://{site}.chargebee.com/api/v2/hosted_pages/checkout_gift \
-u {site_api_key}:\
-d subscription[plan_id]="GiftPlan$100"
Sample Response [ JSON ]
Show more...
{"hosted_page": {
"created_at": 1517505995,
"embed": false,
"expires_at": 1517509595,
"id": "__gift___test__wZIbEJ1opH9ybmh2VbLVpejsaan5wM8U",
"object": "hosted_page",
"resource_version": 1517505995000,
"state": "created",
"type": "checkout_gift",
"updated_at": 1517505995,
"url": "https://yourapp.chargebee.com/pages/v3/__gift___test__wZIbEJ1opH9ybmh2VbLVpejsaan5wM8U/"
}}
URL Format POST
https://{site}.chargebee.com/api/v2/hosted_pages/checkout_gift
The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL.
Note :
- Redirect URL configured in Settings > Hosted Pages Settings would be overriden by this redirect URL.
Eg : http://yoursite.com?id=<hosted_page_id>&state=succeeded - This parameter is not applicable for iframe messaging.
optional, string, max chars=250
Parameters for gifter
pass parameters as gifter[<param name>]
Gifter customer id.
optional, string, max chars=50
Determines which region-specific language Chargebee uses to communicate with the customer. In the absence of the locale attribute, Chargebee will use your site's default language for customer communication.
optional, string, max chars=50
Parameters for subscription
pass parameters as subscription[<param name>]
Identifier of the plan for this subscription.
required, string, max chars=100
subscription[plan_quantity]
Plan quantity for this subscription.
optional, integer, default=1, min=1
subscription[plan_quantity_in_decimal]
Plan Quantity for this subscription in Multi Decimal.
optional, string, max chars=33
Used to uniquely identify the coupon in your website/application and to integrate with Chargebee.
optional, string, max chars=50
Parameters for addons. Multiple addons can be passed by specifying unique indices.
pass parameters as addons[<param name>][<idx:0..n>]
Identifier of the addon. Multiple addons can be passed.
optional, string, max chars=100
Addon quantity. Applicable only for the quantity based addons. Should be passed with the same index as that of associated addon id.
optional, integer, default=1, min=1
addons[quantity_in_decimal][0..n]
The decimal representation of the quantity of the addon. Returned for quantity-based plans when
multi-decimal pricing is enabled.
optional, string, max chars=33
Resource object representing hosted_page.
always returned
Sample Request
curl https://{site}.chargebee.com/api/v2/hosted_pages/claim_gift \
-u {site_api_key}:\
-d gift[id]="__test__KyVnHhSBWmGdM2tv__test__21cdZvclBhOULyCT1SBUPDKjoXsuc3wdj"
copy
curl https://{site}.chargebee.com/api/v2/hosted_pages/claim_gift \
-u {site_api_key}:\
-d gift[id]="__test__KyVnHhSBWmGdM2tv__test__21cdZvclBhOULyCT1SBUPDKjoXsuc3wdj"
Sample Response [ JSON ]
Show more...
{"hosted_page": {
"created_at": 1517678804,
"embed": false,
"expires_at": 1517682404,
"id": "__test__yRVH4Pr8siRXJEPsjeJXlcd8Aq1fDqVzd",
"object": "hosted_page",
"resource_version": 1517678804000,
"state": "created",
"type": "claim_gift",
"updated_at": 1517678804,
"url": "https://yourapp.chargebee.com/pages/v3/__test__yRVH4Pr8siRXJEPsjeJXlcd8Aq1fDqVzd/claim_gift"
}}
URL Format POST
https://{site}.chargebee.com/api/v2/hosted_pages/claim_gift
The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL.
Note :
- Redirect URL configured in Settings > Hosted Pages Settings would be overriden by this redirect URL.
Eg : http://yoursite.com?id=<hosted_page_id>&state=succeeded - This parameter is not applicable for iframe messaging.
optional, string, max chars=250
Parameters for gift
pass parameters as gift[<param name>]
Uniquely identifies a gift.
required, string, max chars=150
Parameters for customer
pass parameters as customer[<param name>]
Determines which region-specific language Chargebee uses to communicate with the customer. In the absence of the locale attribute, Chargebee will use your site's default language for customer communication.
optional, string, max chars=50
Resource object representing hosted_page.
always returned
This is applicable only for Direct Debit via SEPA, Bacs, Bg Autogiro, BECS (for both Australia and New Zealand) and PAD. For Direct Debit, the customer needs to accept an agreement that allows the merchant to debit their bank account. This agreement PDF allows you to easily display scheme-rules compliant Direct Debit mandates to your customers.
This API retrieves the redirect link to the corresponding agreement for customers. The agreement PDF can be your “Thank You” page or sent by email to customers. Communicating this PDF to your customers is mandatory.
Customer locale is used to generate the PDF in the required language. If a customer language is not supported, the PDF is generated in English. Checkout the list of languages supported by GoCardless.
Sample Request
curl https://{site}.chargebee.com/api/v2/hosted_pages/retrieve_agreement_pdf \
-u {site_api_key}:\
-d payment_source_id="pm___test__KyVnHhSBWmKRg2uT"
copy
curl https://{site}.chargebee.com/api/v2/hosted_pages/retrieve_agreement_pdf \
-u {site_api_key}:\
-d payment_source_id="pm___test__KyVnHhSBWmKRg2uT"
Sample Response [ JSON ]
Show more...
{"hosted_page": {
"created_at": 1517506018,
"embed": false,
"expires_at": 1520098018,
"id": "__test__AUCK2LNxny5cXiA1JcdBQE9283e5McdvCC",
"object": "hosted_page",
"resource_version": 1517506018000,
"state": "created",
"type": "agreement_pfd",
"updated_at": 1517506018,
"url": "https://yourapp.chargebee.com/action_pages/__test__AUCK2LNxny5cXiA1JcdBQE9283e5McdvCC/agreement_pdf"
}}
URL Format POST
https://{site}.chargebee.com/api/v2/hosted_pages/retrieve_agreement_pdf
Payment source to be used for this payment.
required, string, max chars=40
Resource object representing hosted_page.
always returned
When a hosted page is successfully completed by the user and processed by Chargebee, its
state
is automatically changed to
succeeded
. Acknowledging a hosted page confirms that you have moved the customer details from Chargebee into your system and are ready to fulfill it. This API is used to acknowledge the hosted page in
succeeded
state and change its state to
acknowledged
.
Note: The hosted page status must be succeeded for this API call to be allowed.
Sample Request
curl https://{site}.chargebee.com/api/v2/hosted_pages/__test__p541yXSwQO7jD2oRNFlBSvqU2s0oiWY0/acknowledge \
-X POST \
-u {site_api_key}:
copy
curl https://{site}.chargebee.com/api/v2/hosted_pages/__test__p541yXSwQO7jD2oRNFlBSvqU2s0oiWY0/acknowledge \
-X POST \
-u {site_api_key}:
Sample Response [ JSON ]
Show more...
{"hosted_page": {
"content": {
"card": {
"card_type": "american_express",
"customer_id": "__test__5SK0bLNFRFuFd5CuE",
"expiry_month": 10,
"expiry_year": 2020,
"first_name": "Hello",
"funding_type": "not_known",
"gateway": "chargebee",
"gateway_account_id": "gw___test__KyVnTyRFuFcGgDu",
"iin": "378282",
"ip_address": "127.0.0.1",
"last4": "0005",
"last_name": "World",
"masked_number": "***********0005",
"object": "card",
"payment_source_id": "pm___test__5SK0bLNFRFuFfTGuV",
"status": "valid"
},
"credit_notes": [
{
"allocations": [
{
"allocated_amount": 895,
"allocated_at": 1517507562,
"invoice_date": 1517507562,
"invoice_id": "__demo_inv__2",
"invoice_status": "paid"
},
{..}
],
"amount_allocated": 895,
"amount_available": 0,
"amount_refunded": 0,
"base_currency_code": "USD",
"currency_code": "USD",
"customer_id": "__test__5SK0bLNFRFuFd5CuE",
"date": 1517507562,
"deleted": false,
"exchange_rate": 1,
"id": "__demo_cn__1",
"line_item_discounts": [],
"line_item_taxes": [],
"line_items": [
{
"amount": 895,
"date_from": 1517507562,
"date_to": 1519926753,
"description": "No Trial - Prorated Credits for 01-Feb-2018 - 01-Mar-2018",
"discount_amount": 0,
"entity_id": "no_trial",
"entity_type": "plan",
"id": "li___test__5SK0bLNFRFuFfTvuY",
"is_taxed": false,
"item_level_discount_amount": 0,
"object": "line_item",
"pricing_model": "per_unit",
"quantity": 1,
"subscription_id": "__test__5SK0bLNFRFuFd5CuE",
"tax_amount": 0,
"tax_exempt_reason": "tax_not_configured",
"unit_amount": 895
},
{..}
],
"linked_refunds": [],
"object": "credit_note",
"price_type": "tax_exclusive",
"reason_code": "subscription_change",
"reference_invoice_id": "__demo_inv__1",
"refunded_at": 1517507562,
"resource_version": 1517507562000,
"round_off_amount": 0,
"status": "refunded",
"sub_total": 895,
"subscription_id": "__test__5SK0bLNFRFuFd5CuE",
"taxes": [],
"total": 895,
"type": "refundable",
"updated_at": 1517507562
},
{..}
],
"customer": {
"allow_direct_debit": false,
"auto_collection": "on",
"billing_address": {
"city": "Chennai",
"country": "IN",
"first_name": "Hello",
"last_name": "World",
"line1": "Wow",
"line2": "Cool",
"object": "billing_address",
"phone": "122242222",
"state": "Tamil Nadu",
"state_code": "TN",
"validation_status": "not_validated",
"zip": "600041"
},
"card_status": "valid",
"created_at": 1517507553,
"deleted": false,
"email": "john@user.com",
"excess_payments": 0,
"first_name": "John",
"id": "__test__5SK0bLNFRFuFd5CuE",
"last_name": "Doe",
"net_term_days": 0,
"object": "customer",
"payment_method": {
"gateway": "chargebee",
"gateway_account_id": "gw___test__KyVnTyRFuFcGgDu",
"object": "payment_method",
"reference_id": "tok___test__5SK0bLNFRFuFfTDuU",
"status": "valid",
"type": "card"
},
"pii_cleared": "active",
"preferred_currency_code": "USD",
"primary_payment_source_id": "pm___test__5SK0bLNFRFuFfTGuV",
"promotional_credits": 0,
"refundable_credits": 0,
"resource_version": 1517507562000,
"taxability": "taxable",
"unbilled_charges": 0,
"updated_at": 1517507562
},
"invoice": {
"adjustment_credit_notes": [],
"amount_adjusted": 0,
"amount_due": 0,
"amount_paid": 605,
"amount_to_collect": 0,
"applied_credits": [
{
"applied_amount": 895,
"applied_at": 1517507562,
"cn_date": 1517507562,
"cn_id": "__demo_cn__1",
"cn_reason_code": "subscription_change",
"cn_status": "refunded"
},
{..}
],
"base_currency_code": "USD",
"billing_address": {
"city": "Chennai",
"country": "IN",
"first_name": "Hello",
"last_name": "World",
"line1": "Wow",
"line2": "Cool",
"object": "billing_address",
"phone": "122242222",
"state": "Tamil Nadu",
"state_code": "TN",
"validation_status": "not_validated",
"zip": "600041"
},
"credits_applied": 895,
"currency_code": "USD",
"customer_id": "__test__5SK0bLNFRFuFd5CuE",
"date": 1517507562,
"deleted": false,
"due_date": 1517507562,
"exchange_rate": 1,
"first_invoice": false,
"has_advance_charges": false,
"id": "__demo_inv__2",
"is_gifted": false,
"issued_credit_notes": [],
"line_items": [
{
"amount": 1500,
"date_from": 1517507562,
"date_to": 1519926753,
"description": "Plan1 - Prorated Charges",
"discount_amount": 0,
"entity_id": "plan1",
"entity_type": "plan",
"id": "li___test__5SK0bLNFRFuFfTpuW",
"is_taxed": false,
"item_level_discount_amount": 0,
"object": "line_item",
"pricing_model": "per_unit",
"quantity": 1,
"subscription_id": "__test__5SK0bLNFRFuFd5CuE",
"tax_amount": 0,
"tax_exempt_reason": "tax_not_configured",
"unit_amount": 1500
},
{..}
],
"linked_orders": [],
"linked_payments": [
{
"applied_amount": 605,
"applied_at": 1517507562,
"txn_amount": 605,
"txn_date": 1517507562,
"txn_id": "txn___test__5SK0bLNFRFuFfUeua",
"txn_status": "success"
},
{..}
],
"net_term_days": 0,
"object": "invoice",
"paid_at": 1517507562,
"price_type": "tax_exclusive",
"recurring": true,
"resource_version": 1517507562000,
"round_off_amount": 0,
"shipping_address": {
"city": "Chennai",
"country": "IN",
"first_name": "Hello",
"last_name": "World",
"line1": "Wow",
"line2": "Cool",
"object": "shipping_address",
"phone": "122242222",
"state": "Tamil Nadu",
"state_code": "TN",
"validation_status": "not_validated",
"zip": "600041"
},
"status": "paid",
"sub_total": 1500,
"subscription_id": "__test__5SK0bLNFRFuFd5CuE",
"tax": 0,
"term_finalized": true,
"total": 1500,
"updated_at": 1517507562,
"write_off_amount": 0
},
"subscription": {
"activated_at": 1517507553,
"billing_period": 1,
"billing_period_unit": "month",
"created_at": 1517507553,
"currency_code": "USD",
"current_term_end": 1519926753,
"current_term_start": 1517507553,
"customer_id": "__test__5SK0bLNFRFuFd5CuE",
"deleted": false,
"due_invoices_count": 0,
"has_scheduled_changes": false,
"id": "__test__5SK0bLNFRFuFd5CuE",
"mrr": 0,
"next_billing_at": 1519926753,
"object": "subscription",
"plan_amount": 1500,
"plan_free_quantity": 0,
"plan_id": "plan1",
"plan_quantity": 1,
"plan_unit_price": 1500,
"resource_version": 1517507562000,
"shipping_address": {
"city": "Chennai",
"country": "IN",
"first_name": "Hello",
"last_name": "World",
"line1": "Wow",
"line2": "Cool",
"object": "shipping_address",
"phone": "122242222",
"state": "Tamil Nadu",
"state_code": "TN",
"validation_status": "not_validated",
"zip": "600041"
},
"started_at": 1517507553,
"status": "active",
"updated_at": 1517507562
}
},
"created_at": 1517507553,
"embed": false,
"expires_at": 1517511153,
"id": "__test__p541yXSwQO7jD2oRNFlBSvqU2s0oiWY0",
"object": "hosted_page",
"resource_version": 1517507577000,
"state": "acknowledged",
"type": "checkout_existing",
"updated_at": 1517507577,
"url": "https://yourapp.chargebee.com/pages/v2/__test__p541yXSwQO7jD2oRNFlBSvqU2s0oiWY0/checkout"
}}
URL Format POST
https://{site}.chargebee.com/api/v2/hosted_pages/{hosted_page_id}/acknowledge
Resource object representing hosted_page.
always returned
Retrieves a hosted page resource.
Sample Request
curl https://{site}.chargebee.com/api/v2/hosted_pages/__test__Mgd44pMvDRJLhuy3KNs2j6qBRNbuGG9r \
-u {site_api_key}:
copy
curl https://{site}.chargebee.com/api/v2/hosted_pages/__test__Mgd44pMvDRJLhuy3KNs2j6qBRNbuGG9r \
-u {site_api_key}:
Sample Response [ JSON ]
Show more...
{"hosted_page": {
"created_at": 1517506016,
"embed": true,
"expires_at": 1517509616,
"id": "__test__Mgd44pMvDRJLhuy3KNs2j6qBRNbuGG9r",
"object": "hosted_page",
"resource_version": 1517506016000,
"state": "created",
"type": "checkout_existing",
"updated_at": 1517506016,
"url": "https://yourapp.chargebee.com/pages/v2/__test__Mgd44pMvDRJLhuy3KNs2j6qBRNbuGG9r/checkout"
}}
URL Format GET
https://{site}.chargebee.com/api/v2/hosted_pages/{hosted_page_id}
Resource object representing hosted_page.
always returned
Sample Request
curl https://{site}.chargebee.com/api/v2/hosted_pages \
-G \
-u {site_api_key}:\
--data-urlencode limit=2
copy
curl https://{site}.chargebee.com/api/v2/hosted_pages \
-G \
-u {site_api_key}:\
--data-urlencode limit=2
Sample Response [ JSON ]
Show more...
{
"list": [
{"hosted_page": {
"created_at": 1517678804,
"embed": false,
"expires_at": 1517682404,
"id": "__test__yRVH4Pr8siRXJEPsjeJXlcd8Aq1fDqVzd",
"object": "hosted_page",
"resource_version": 1517678804000,
"state": "created",
"type": "claim_gift",
"updated_at": 1517678804,
"url": "https://yourapp.chargebee.com/pages/v3/__test__yRVH4Pr8siRXJEPsjeJXlcd8Aq1fDqVzd/claim_gift"
}},
{..}
],
"next_offset": "[\"1517506012000\",\"186000000018\"]"
}
URL Format GET
https://{site}.chargebee.com/api/v2/hosted_pages
The number of resources to be returned.
optional, integer, default=10, min=1, max=100
Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set offset
to the value of next_offset
obtained in the previous iteration of the API call.
optional, string, max chars=1000
Unique identifier generated for each hosted page requested.
Supported operators : is, is_not, starts_with, in, not_in
Example → id[is] = "Edi69nxpu6BeGBd9Fjcd0tqCSwb0sRcuKa"
optional, string filter
Type of the requested hosted page. Possible values are : checkout_new, checkout_existing, update_payment_method, manage_payment_sources, collect_now, extend_subscription, checkout_gift, claim_gift, checkout_one_time.
Supported operators : is, is_not, in, not_in
Example → type[is] = "checkout_new"
optional, enumerated string filter
Indicating the current state of the hosted page resource. Possible values are : created, requested, succeeded, cancelled, acknowledged.
Supported operators : is, is_not, in, not_in
Example → state[is] = "succeeded"
optional, enumerated string filter
Timestamp indicating when this hosted page was last updated.
Supported operators : after, before, on, between
Example → updated_at[after] = "1490784813"
optional, timestamp(UTC) in seconds filter
Resource object representing hosted_page.
always returned
next_offset
This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter “offset”.
optional, string, max chars=1000