Creating product key with javascript

Hi,
I’m trying to generate a key with javascript. It’s code being run on a server which is triggered whenever a user makes a purchase. I’m using the request library and I’m able to create a product key which has one custom field. However, I need multiple custom fields and this fails. I suspect it’s because the fact I can’t supply multiple custom fields in a flat array. But I also can’t supply multiple cust_field_id[] and custom_field_value[] items to my request. Presumably sending multiple items with the same titles doesn’t work.

Hi,

Did you try following:

request.post(apiUrl, {form:{cust_field_id:[‘300’,'301], custom_field_value: [“first value”, “second value”]}})

That’s great, it works. I’d never think of that though.