Skip to main content

Hi.  Whenever I supply custom metadata in my Web SDK purchase call (as described here https://www.revenuecat.com/docs/web/web-billing/custom-metadata), the Event Data for the purchase shows a “metadata” value of null, and the webhook request body for that event then also shows a “metadata” value of null.  I’m using a web billing app.

The exact request I’m making is:
 

const { customerInfo } = await Purchases.getSharedInstance().purchase({
rcPackage: pkg,
metadata: {
org_id: "01970d2a-3f5b-724c-b306-5aca641ffba3",
event_id: "01972cdb-f765-756b-ae95-203f516ff6e6"
},
});

I can see the metadata being set correctly in the POST request to https://api.revenuecat.com/rcbilling/v1/checkout/start, it just never seems to actually be stored and associated with the event once the checkout is completed.

I’m using the @revenuecat/purchases-js library on version 1.4.3.  

Is there something I’m doing incorrectly or am I missing something?  Or is there just a bug with processing this metadata on the backend?  Thanks in advance.

 

Hi ​@chris-3a3b62,

The “metadata” that you’re sending via the purchase call (which I can confirm looks correct and I do see it being set as well) will be sent only in the `INITIAL_PURCHASE` webhook event at this time: https://www.revenuecat.com/docs/web/web-billing/custom-metadata#how-to-use-the-collected-metadata

I do see that this seems to be working - are you able to check out a couple of initial purchase events for your users and confirm?


Hi ​@chris-3a3b62,

The “metadata” that you’re sending via the purchase call (which I can confirm looks correct and I do see it being set as well) will be sent only in the `INITIAL_PURCHASE` webhook event at this time: https://www.revenuecat.com/docs/web/web-billing/custom-metadata#how-to-use-the-collected-metadata

I do see that this seems to be working - are you able to check out a couple of initial purchase events for your users and confirm?

Thanks for looking into this Kaitlin.  Ah that makes sense, I’m not sure how I missed that in the docs.  You’re correct, I do see the metadata on `INITIAL_PURCHASE` events, unfortunately the only events I needed the metadata for were `NON_RENEWING_PURCHASE` events.  I’ll work around it on my end.  Thank you.


@chris-3a3b62,

I’ll check if we can make this more clear in the documentation and submit feedback to the team for sending it in `NON_RENEWING_PURCHASE` events as well - there’s definitely a use case there for apps that rely on on time purchases. 


Reply