Start a new topic

How to set meta_data using the API?

I tried to create a subscription with meta data. My request is like this:


https://XXX/api/v2/hosted_pages/checkout_new 


billing_cycles:10000 

customer[id]:YYYY

subscription[auto_collection]:on

subscription[meta_data]:[{"field1"["value1","value2"]}]

subscription[plan_id]:[ZZZZ] 

subscription[plan_quantity]:2]


It doesn't work. The subscription was created successfully w/o the meta data.

Did I do it wrongly or hosted page API doesn't support meta_data?

1 Comment

Hi Chao,

You're right, you wouldn't be able to use Chargebee's hosted pages API to pass in meta-data values.


Hosted pages API is used to create a link (URL) which will be sent to the customers, so that they can go through the checkout process to sign up for a new subscription.

You can pass on meta-data using Chargebee's create subscriptions API, where a subscription is created using API and the meta-data is passed within that API itself.
Also, meta-data can be passed even while updating a subscription. So, after the subscription is successfully signed-up by your customer, you can call update the subscription API to pass the metadata. 

More on subscription's API here.
More on hosted pages API here.
More on meta-data here.

Please note that metadata is only for your reference and will not be visible to customers.

I see that we have also been able to write to your email via the support channel about this! Feel free to let us know if we could help further :)

Regards,
Nandhini
Chargebee Solutions
Login or Signup to post a comment