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

Modified on: Thu, 11 Aug, 2022 at 5:07 PM

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?

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.
×