Docs

Site Configuration Articles & FAQ

custom, field, pre, fill, pass, value

41075087

2022-05-20T11:22:31Z

2025-02-12T08:23:52Z

972

0

1

254502

How to pass values to custom fields using in-app scripts?

How to pass values to custom fields using in-app scripts? 

Scope

Does the In-app Script allow me to pass a value to the Custom Fields?

Does the In-app Script allow me to pass the customer's email to the Checkout or portal?

Summary

In Chargebee, it is possible to pre-fill the custom fields in Checkout and Portal either with the drop-in script or by using Chargebee's API.

Solution

Via Drop-in Script

Once the custom field is created, all the parameters for the Customer can be passed using the setCustomer function. This information will be passed to checkout and will be prefilled - including the custom field.

You can use the SetCustomdata function to pass the Subscription level custom fields. To know more about the Checkout page script.

Please refer to the example shown under drop-in script customizations from here.

Via API

Custom field parameters start only with 'cf' as shown in the image below

Sample Custom filed format for which the parameters need to be passed.

You can view the custom fields format from this link, and navigate to Checkout new subscription > Input parameter > Customer.

More on API docs for hosted pages here.

via Hosted page URL

In a hosted page URL for a plan, you can pass the custom field as a parameter and embed it in the checkout button on your page.

Refer to the Pre-filling/Passing custom fields to hosted pages (via Plan URL) document to know more.

You can also read more about Custom Fields.

Related Links:

Is it possible to filter set custom fields as filters via the APIs?

Can custom fields be displayed in the customer portal and checkout pages?

How to display custom fields on invoices

How do I display custom fields to customers?

Was this article helpful?
Loading…