POST /hosted_pages/checkout_gift_for_items

Creates a hosted page for a customer (called the gifter) to gift a subscription to another customer (called the receiver).

Gifter customer resource lookup and creation {#gifter_lookup}

When gifter[customer_id] is provided, it is looked up in Chargebee when the gifter completes the hosted page checkout. If not found, a new customer resource is created with this ID.

Multiple business entities

If multiple business entities are created for the site, the lookup and creation of the gifter customer resource 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.

Gift receiver customer resource lookup and creation {#receiver_lookup}

Once the gifter checks out using the hosted page returned by this endpoint, Chargebee checks if a customer resource with the receiver's email address exists. The first such customer record is considered the receiver's customer resource. A new customer resource is created for the receiver if none are found.

Multiple business entities

If multiple business entities are created for the site, the lookup and creation of the gift receiver's customer resource happen within the context of the business entity of the gifter

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
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.
gifter Object No

Parameters for gifter

gifter.customer_id String No

The customer ID of the gifter. If not provided, the gifter customer resource is created with an autogenerated ID on checkout.
See also

Gifter customer resource lookup and creation

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

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

Gifter customer resource lookup and creation.

subscription_items Object No

Parameters for subscription_items

subscription_items.item_price_id[] Array No

The unique identifier of the item price.

subscription_items.quantity[] Array No

The quantity of the item purchased

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

coupon_ids[] Array No

List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes.

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.