POST /hosted_pages/checkout_one_time_for_items

Create a Chargebee hosted page to accept payment details from a customer and checkout charge-items and one-time charges.

The following steps describe how best to use this API:

  1. Call this endpoint, providing item prices, charges, coupons and a host of other details such as billing and shipping addresses of the customer, to be prefilled on the checkout page. You may also provide pass_thru_content containing information and IDs from your systems that must be associated with the checkout page.
  2. Send the customer to the Checkout url received in the response.
  3. Once they complete checkout, the set of charge-items 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.
  4. Retrieve the hosted page at this stage to get the invoice details.

Customer resource lookup and creation {#customer_lookup1}

When customer[id] is provided for this operation, it is looked up by Chargebee, and if found, the hosted_page is created for it. If not found, a new customer resource is created with an autogenarated ID, and the hosted_page is created.

Multiple business entities

If multiple business entities are created for the site, the customer resource lookup and creation happen within the context of the business entity specified in this API call. If no business entity is specified, the customer resource lookup is performed within the site context , and if not found, the resource is created for the default business entity of the site.

Servers

Request headers

Name Type Required Description
chargebee-request-origin-device String No

The device from which the customer has made the request

Content-Type String Yes The media type of the request body.

Default value: "application/x-www-form-urlencoded"

chargebee-event-webhook String No

skip only webhooks

Possible values:

  • "all-disabled"
chargebee-business-entity-id String No

If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation.

chargebee-event-actions String No

skip all actions to be done on the events

Possible values:

  • "all-disabled"
chargebee-request-origin-user String No

The email address of your customer/user. Use this when the email address has only ASCII characters.

chargebee-request-origin-ip String No

The IP address of the customer where the request originated

chargebee-request-origin-user-encoded String No

The Base64-encoded email address of your customer/user. Use this if the email address has UTF-8 characters. When this header is provided, the header chargebee-request-origin-user is ignored.

chargebee-event-email String No

skip only emails

Possible values:

  • "all-disabled"

Request body fields

Name Type Required Description
shipping_address Object No

Parameters for shipping_address

shipping_address.first_name String No

The first name of the contact.

shipping_address.state String No

The state/province name. Is set by Chargebee automatically for US, Canada and India If state_code is provided.

shipping_address.city String No

The name of the city.

shipping_address.validation_status String No

The address verification status. * partially_valid - The address is valid for taxability but has not been validated for shipping. * invalid - Address is invalid. * not_validated - Address is not yet validated. * valid - Address was validated successfully.

Possible values:

  • "partially_valid"
  • "valid"
  • "not_validated"
  • "invalid"

Default value: "not_validated"

shipping_address.line2 String No

Address line 2

shipping_address.line1 String No

Address line 1

shipping_address.email String No

The email address.

shipping_address.last_name String No

The last name of the contact.

shipping_address.company String No

The company name.

shipping_address.line3 String No

Address line 3

shipping_address.state_code String No

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).

shipping_address.zip String No

Zip or postal code. The number of characters is validated according to the rules specified here.

shipping_address.phone String No

The phone number.

shipping_address.country String No

The billing address country of the customer. Must be one of ISO 3166 alpha-2 country code.

Note : If you enter an invalid country code, the system will return an error.

Brexit

If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then XI (the code for United Kingdom -- Northern Ireland) is available as an option.

discounts Object No

Parameters for discounts

discounts.apply_on[] Array Yes
discounts.percentage[] Array No

The percentage of the original amount that should be deducted from it.

discounts.amount[] Array No

The value of the discount. The format of this value depends on the kind of currency.

discounts.item_price_id[] Array No

The id of the item price in the subscription to which the discount is to be applied. Relevant only when apply_on = specific_item_price.

layout String No

Specifies the checkout layout that overrides the default checkout layout configured in the Checkout & Self-Serve Portal settings. . * in_app - Indicates in-app checkout version * full_page - Indicates full page checkout version

Possible values:

  • "full_page"
  • "in_app"
currency_code String No

The currency code (ISO 4217 format) of the invoice amount.

pass_thru_content String No

This attribute allows you to store custom information with the hosted_page object. You can use it to associate specific data with a hosted page session.

For example, you can store the ID of the marketing campaign that initiated the user session. After a successful checkout, when the customer is redirected, you can retrieve the hosted page ID from the redirect URL's query parameters. Using this ID, you can fetch the hosted page and perform actions related to the success of the marketing campaign.

cancel_url String No

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.
business_entity_id String No

Sets the context for this operation to the business entity specified. Applicable only when multiple business entities have been created for the site. When this parameter is provided, the operation is able to read/write data associated only to the business entity specified. When not provided, the operation can read/write data for the entire site.
Note

An alternative way of passing this parameter is by means of a custom HTTP header.
See also

Customer resource lookup and creation.

entity_identifiers Object No

Parameters for entity_identifiers

entity_identifiers.id[] Array No

The unique id for the entity_identifier[i] in Chargebee. This is required when entity_identifier[operation][i] is update or delete.

entity_identifiers.operation[] Array No
entity_identifiers.value[] Array No

The value of the entity_identifier. This identifies the customer entity on the Peppol network. For example: 10101010-STO-10.
Tip:

If there is only one entity identifier for the customer and the value is the same as vat_number, then there is no need to provide the entity_identifiers[] array. See description for entity_identifiers[].

entity_identifiers.scheme[] Array No

The Peppol BIS scheme associated with the vat_number of the customer. This helps identify the specific type of customer entity. For example, DE:VAT is used for a German business entity while DE:LWID45 is used for a German government entity. The value must be from the list of possible values and must correspond to the country provided under billing_address.country. See list of possible values.
Tip:

If there is only one entity identifier for the customer and the value is the same as vat_number, then there is no need to provide the entity_identifiers[] array. See description for entity_identifiers[].

entity_identifiers.standard[] Array No

The standard used for specifying the entity_identifier scheme. Currently, only iso6523-actorid-upis is supported and is used by default when not provided.
Tip:

If there is only one entity identifier for the customer and the value is the same as vat_number, then there is no need to provide the entity_identifiers[] array. See description for entity_identifiers[].

card Object No

Parameters for card

card.gateway_account_id String No

The gateway account in which this payment source is stored.

invoice_note String No

A note for this particular invoice. This, and all other notes for the invoice are displayed on the PDF invoice sent to the customer.

coupon_ids[] Array No

List of Coupons to be added.

item_prices Object No

Parameters for item_prices

item_prices.unit_price[] Array No

The price or per-unit-price of the item price. By default, it is the value set for the item_price. This is only applicable when the pricing_model of the item_price is flat_fee or per_unit. The value depends on the type of currency.

item_prices.date_from[] Array No

The time when the service period for the item starts.

item_prices.date_to[] Array No

The time when the service period for the item ends.

item_prices.unit_price_in_decimal[] Array No

The decimal representation of the price or per-unit price of the plan. The value is in major units of the currency. Always returned when multi-decimal pricing is enabled.

item_prices.item_price_id[] Array No

A unique ID for your system to identify the item price.

item_prices.quantity[] Array No

Item price quantity

item_prices.quantity_in_decimal[] Array No

The decimal representation of the quantity of the item purchased. Can be provided for quantity-based item prices and only when multi-decimal pricing is enabled.

customer Object No

Parameters for customer

customer.taxability String No

Specifies if the customer is liable for tax * 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.

* taxable - Computes 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.

Possible values:

  • "exempt"
  • "taxable"

Default value: "taxable"

customer.consolidated_invoicing Boolean No

Indicates whether invoices raised on the same day for the customer are consolidated. When provided, this overrides the default configuration at the site-level. This parameter can be provided only when Consolidated Invoicing is enabled.
Note:

Any invoices raised when a subscription activates from in_trial or future status, are not consolidated by default. Contact Support to enable consolidation for such invoices.

customer.first_name String No

First name of the customer. If not provided it will be got from contact information entered in the hosted page

customer.entity_identifier_scheme String No

The Peppol BIS scheme associated with the vat_number of the customer. This helps identify the specific type of customer entity. For example, DE:VAT is used for a German business entity while DE:LWID45 is used for a German government entity. The value must be from the list of possible values and must correspond to the country provided under billing_address.country. See list of possible values.
Tip:

If there are additional entity identifiers for the customer not associated with the vat_number, they can be provided as the entity_identifiers[] array.

customer.vat_number String No

The VAT/tax registration number for the customer. For customers with billing_address country as XI (which is United Kingdom - Northern Ireland ), the first two characters of the full VAT number can be overridden by setting vat_number_prefix.

customer.id String No

The unique ID of the customer for which this hosted_page should be created. If not provided, the ID of the newly created customer resource is autogenerated.
See also

Customer resource lookup and creation.

customer.email String No

Email of the customer. Configured email notifications will be sent to this email.

customer.last_name String No

Last name of the customer. If not provided it will be got from contact information entered in the hosted page

customer.company String No

Company name of the customer.

customer.vat_number_prefix String No

An overridden value for the first two characters of the full VAT number. Only applicable specifically for customers with billing_address country as XI (which is United Kingdom - Northern Ireland ).

When you have enabled EU VAT in 2021 or have manually enabled the Brexit configuration, you have the option of setting billing_address country as XI. That's the code for United Kingdom - Northern Ireland . The first two characters of the VAT number in such a case is XI by default. However, if the VAT number was registered in UK, the value should be GB. Set vat_number_prefix to GB for such cases.

customer.phone String No

Phone number of the customer

customer.locale String No

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.

customer.entity_identifier_standard String No

The standard used for specifying the entity_identifier_scheme. Currently only iso6523-actorid-upis is supported and is used by default when not provided.
Tip:

If there are additional entity identifiers for the customer not associated with the vat_number, they can be provided as the entity_identifiers[] array.

Default value: "iso6523-actorid-upis"

customer.einvoicing_method String No

null

Possible values:

  • "manual"
  • "site_default"
  • "automatic"
customer.is_einvoice_enabled Boolean No

Determines whether the customer is e-invoiced. When set to true or not set to any value, the customer is e-invoiced so long as e-invoicing is enabled for their country (billing_address.country). When set to false, the customer is not e-invoiced even if e-invoicing is enabled for their country.
Tip:

It is possible to set a value for this flag even when E-Invoicing is disabled. However, it comes into effect only when E-Invoicing is enabled.

redirect_url String No

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 :

  • Although the customer will be redirected to the redirect_url after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons such as user closing the tab, or exiting the browser, and so on. If there is any synchronization that you are doing after the redirection, you will have to have a backup. Chargebee recommends listening to appropriate webhooks such as subscription_created or invoice_generatedto verify a successful checkout.
  • 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.
invoice Object No

Parameters for invoice

invoice.po_number String No

Purchase Order Number for this invoice.

item_tiers Object No

Parameters for item_tiers

item_tiers.starting_unit_in_decimal[] Array No

The decimal representation of the lowest value of quantity in this tier. This is zero for the lowest tier. For all other tiers, it is the same as ending_unit_in_decimal of the next lower tier. Returned only when the pricing_model is tiered, volume or stairstep and multi-decimal pricing is enabled.

item_tiers.price_in_decimal[] Array No

The decimal representation of the per-unit price for the tier when the pricing_model is tiered or volume. When the pricing_model is stairstep, it is the decimal representation of the total price for the item. The value is in major units of the currency. Returned when the plan is quantity-based and multi-decimal pricing is enabled.

item_tiers.package_size[] Array No

Package size for the tier when pricing type is package. Specify the number of units that make up one package. For example, if 1000 API hits are grouped into a single package, set the package size to 1000.

item_tiers.price[] Array No

The per-unit price for the tier when the pricing_model is tiered or volume. The total cost for the item price when the pricing_model is stairstep. The value is in the minor unit of the currency.

item_tiers.ending_unit[] Array No

The highest value in the quantity tier.

item_tiers.item_price_id[] Array No

The id of the item price to which this tier belongs.

item_tiers.pricing_type[] Array No
item_tiers.starting_unit[] Array No

The lowest value in the quantity tier.

item_tiers.ending_unit_in_decimal[] Array No

The decimal representation of the highest value of quantity in this tier. This attribute is not applicable for the highest tier. For all other tiers, it must be equal to the starting_unit_in_decimal of the next higher tier. Returned only when the pricing_model is tiered, volume or stairstep and multi-decimal pricing is enabled.

charges Object No

Parameters for charges

charges.description[] Array No

Description for this charge

charges.date_to[] Array No

The time when the service period for the charge ends.

charges.avalara_tax_code[] Array No

The Avalara tax codes to which items are mapped to should be provided here. Applicable only if you use Chargebee's AvaTax for Sales integration.

charges.avalara_sale_type[] Array No
charges.avalara_service_type[] Array No

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.

charges.date_from[] Array No

The time when the service period for the charge starts.

charges.amount_in_decimal[] Array No

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.

charges.tax_profile_id[] Array No

Tax profile of the charge.

charges.amount[] Array No

The amount to be charged. The unit depends on the type of currency.

charges.taxjar_product_code[] Array No

The TaxJar product codes to which items are mapped to should be provided here. Applicable only if you use Chargebee's TaxJar integration.

charges.taxable[] Array No

The amount to be charged is taxable or not.

charges.hsn_code[] Array No

The HSN code to which the item is mapped for calculating the customer's tax in India. Applicable only when both of the following conditions are true:

  • India has been enabled as a Tax Region. (An error is returned when this condition is not true.)
  • The AvaTax for Sales integration has been enabled in Chargebee.
charges.avalara_transaction_type[] Array No

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.

billing_address Object No

Parameters for billing_address

billing_address.first_name String No

The first name of the billing contact.

billing_address.state String No

The state/province name. Is set by Chargebee automatically for US, Canada and India If state_code is provided.

billing_address.city String No

The name of the city.

billing_address.validation_status String No

The address verification status. * valid - Address was validated successfully. * partially_valid - The address is valid for taxability but has not been validated for shipping. * invalid - Address is invalid. * not_validated - Address is not yet validated.

Possible values:

  • "partially_valid"
  • "valid"
  • "not_validated"
  • "invalid"

Default value: "not_validated"

billing_address.line2 String No

Address line 2

billing_address.line1 String No

Address line 1

billing_address.email String No

The email address.

billing_address.last_name String No

The last name of the billing contact.

billing_address.company String No

The company name.

billing_address.line3 String No

Address line 3

billing_address.state_code String No

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).

billing_address.zip String No

Zip or postal code. The number of characters is validated according to the rules specified here.

billing_address.phone String No

The phone number.

billing_address.country String No

The billing address country of the customer. Must be one of ISO 3166 alpha-2 country code.

Note : If you enter an invalid country code, the system will return an error.

Brexit

If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then XI (the code for United Kingdom -- Northern Ireland) is available as an option.

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.