can someone please advise me on how to create a Paypal subscription button that is associated with my subscription plan and can contain a custom parameter?
I would like to specify a custom parameter in the button for each buyer such as CustomerId=1234 so, I can register the buyer as my member immediately.
I currently found the way to create a subscription button but cannot add any parameter.
Thank you in advance
When creating the subscription, add the parameter custom_id.
This is documented in the Create subscription request body.
Related
I am trying to set up a recurring payment with PayPal Subscription REST API. I'm following the Basic Integration in PayPal Developer Portal, using as suggested the Smart Payment Button. Besides, I'm using a WebHook to "capture" events related to subscription.
As the tutoria suggest, I created a Product and a Plan.
Now, I rendered the Smart Payment Button in a page (using the example), and when clicked it triggers the PayPal authorization flow. When the user complete the subscription process, the BILLING.SUBSCRIPTION.CREATED event is triggered. Later, also the PAYMENT.SALE.COMPLETED and BILLING.SUBSCRIPTION.ACTIVATED are triggered, and I receive data in my WebHook. Now, I have troubles in identifying which user activated the subscription. My idea is to pass a custom variable (with something allows me to identify the user) and retrive it later when the WebHook post me data, but I can't undertand how to do it. Anyway, is this the best way to do it? Or there is another solution?
I solved this using "custom_id" in the smart button:
return actions.subscription.create({
'plan_id': 'PLAN_ID',
'custom_id': 'CUSTOM_ID'
});
Then, I receive custom_id from webhooks or querying the subscription.
I need to match the user who triggered the initial Http message sent to paypal, to the IPN i'm receiving on my backend when the transaction is completed. Since Paypal is unaware of my user database I'm looking for some kind of transaction ID.
the thing is, when a user clicks on a paypal hosted button, Paypal opens another window and processes the buyer login and every other payment steps there.
I've had a look at the URL of that new Paypal window and there is nothing there that will also be stated on the IPN.
Is there a way to check the initial http message sent to paypal from my frontend?
You can use the custom parameter to pass your own unique ID into the payment request. This would then be returned in the same custom parameter included in IPN.
The field is literally called custom and you can pass anything you want in it up to 256 characters.
You should be able to add it as an additional hidden field in your HTML form for the hosted button. If it doesn't pass as expected that way, though, you'll need to use a non-hosted button.
I've got paypal recurring payment buttons on my website.
I'm passing subscription type and user id through custom data.
It's reversed and base64 coded. But still someone can edit it and change subscription type or/and user id. Am I right?
Should i check payment amount and then verify type or what...
Is custom data field in paypal button safe to work with?
You should encrypt your payment buttons - see Securing Your PayPal Payments Standard Buttons.
I'm trying to using paypal as payment for my site.
My site only sell a virtual currency, like "Diamond" in Online game.
So after reading i starting to use Express Checkout for Digital Goods, Is that right ? or i must other payment method ?
Then my question is when using Express Checkout for Digital Goods, how to pass custom variable ?
Let say i want to pay user_id, diamond_id, and some other variable from my database to the paypal api. It seem like paypal don't support custom variable to pass on the api call. I want after user complete the payment, then Paypal notify my server that the payment is complete by user_id and some other variable that i pass, so easy for me to know the detail.
after searching i find some solution,
First solution is to store "TOKEN"(Generated from "SetExpressCheckout" Method) and my custom variable which is belong to the TOKEN in the database, Then after payment complete paypal will notify my server the same TOKEN saved before. So i will query based on the TOKEN.
Second Solution is using get style in RETURNURL variable http://www.mysite.com/successpayment.php?user_id=13&diamond_id=88 So i will easy to grab the GET variable.
Which solution is right ? Is there any solution ? and how to secure the payment confirmation, i mean if someone know and hack my returnurl.
Thanks in advance
There are two parts to be able to successfully identify your order in the whole process:
To identify your order when the user is redirected back via the success or cancel URL, just pass the order id via the query string of the URL.
To identify your order when Paypal sends notifications about the transaction and associated events (refunds, reversals, disputes etc.) via IPN: Paypal does support a pass-through variable, which allows you to associate IPNs to the order record in your DB.
For express checkout you set PAYMENTREQUEST_0_INVNUM in the SetExpressCheckout call
In case you are creating a recurring profile, the parameter is named PROFILEREFERENCE in the CreateRecurringPaymentsProfile call
When you receive an IPN the invoice is passed as 'invoice' or 'rp_invoice_id' respectively
(My general advice, though: use Paypal only if you really have to)
Gday All,
I am developing a site that uses PayPal to take online payments.
I need to be able to send my client an email with the link to PayPal in order to pay.
In this link I need a way to set a unique value (for example bookingId) that I can use to add the receipt number to the correct booking via PayPal's payment notification feature.
Does anyone know what custom value I can set in order to achieve this?
Cheers,
Michael
The "item_name" field will be displayed to the user and can be set to whatever you like. I use it for conference registration ID's, while using item_number to track what was actually purchased.
Use Invoice field.
You can use any of the following passthrough variables:
custom
item_number or item_number_x
invoice
See page 409 in the PayPal Website Payments Standard Integration Guide:
https://cms.paypal.com/cms_content/US/en_US/files/developer/PP_WebsitePaymentsStandard_IntegrationGuide.pdf
for details.