How do I add custom metadata to PayPal so it can be sent with the webhook?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to set up a webhook so that I can fulfill the payment on my server. The problem is I need to identify the user in the database. Usually with webhooks there is the option to send custom metadata, so I can send the user ID to PayPal and receive it with the webhook. This is very easy with Stripe, I am surprised how difficult everything is with PayPal (I have encountered so many problems already trying to set this up).
I am using the paypal.Buttons.render() method to generate the Smart Buttons. Is there an option to set metadata with this? I can't find it anywhere in the documentation and there are some old posts about using a hidden <input /> field, but I think this is outdated with the new payment buttons.
- Labels:
-
Payments REST APIs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Add a custom_id in the purchase units section of create order
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: document.getElementById('amount').value
},
description: document.getElementById('description').value,
custom_id: 'my custom string',
}],
shipping_preference: 2
});
},
It will show in the Webhooks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have try this method for CreateSubscription but i don't see custom_id in webhook.
[Solved] Sorry for posting, the method below works correctly

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Problem with invoices in REST APIs
- Assistance Needed: Passing and Retrieving Custom Data in PayPal Webhook Payload in PayPal Payments Standard
- NOT ENABLED TO VAULT PAYMENT SOURCE in Sandbox Environment
- CHECKOUT.ORDER.APPROVED webhook event not triggered if payment_source is passed in in REST APIs
- "issue": "NOT_ENABLED_TO_VAULT_PAYMENT_SOURCE" in REST APIs