Search code examples
phppaypalpaypal-subscriptions

PayPal PHP SDK - how can I pass a custom variable through PayPal?


I trying to create a registration system with PayPal subscriptions, the register part is done and the subscription creating too. I need to check if the customer payed, and then the user needs to become premium.

So my question: How can I set a custom field in a PayPal PHP SDK subscription? I want to pass a user identifier through PayPal, I noticed that it is possible but I couldn't find a solution for the PayPal PHP SDK.

Any solutions? Or is this not the right approach.


Solution

    1. The PHP SDK does not support the latest version of the Subscriptions API, so you should not use the PHP SDK. Use HTTPS calls directly.

    2. The Subscriptions API does not allow passing a custom variable. Save the SubscriptionID at creation time and associate it with a user object in your own database. Store all the registration data associated with that user object or the subscription object.