Adding points purchased using URL variables from Amazon Payments

mdayton - June 17, 2009 - 15:29
Project:User Points
Version:6.x-1.0
Component:Code: userpoints API
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I am trying to give customers the ability to purchase userpoints using Amazon Payments. Users are returned to a URL I specify with transaction details contained in the URL after completing a payment transaction. A sample return URL is listed below:

http://mysite.com/payments/credits_confirm?recipientEmail=aws%40mybiz&transactionId=147NB22BS4716IBHGA9V8AUG77OGU9DDHDM&buyerName=first+last&transactionDate=1245250128&recipientName=EPMCloud+Test+Business&paymentMethod=Credit+Card&status=PR&buyerEmail=myemail%40gmail.com&referenceId=10&paymentReason=10+Credits+(TEST)&operation=reserve&transactionAmount=100

I would like to verify that the URL "status" value = PS, then add the number of user points contained in the "referenceId" URL value. I would also like to add "Reason" and perhaps the "transactionId" (from Amazon) to the user point submission for tracking purposes. If "status" value is something other than PS, I would redirect user to another "payment failed" page.

Is this possible with a PHP snippet contained in the /credits_confirm page, or do I need to develop a module to handle this? I have tried inserting URL variables in api call just for testing, but it appears that the function runs without any variable data being first inserted. The result is that 1 user point is added to the currently logged in user's account, regardless of how many points were in the referenceId field from the URL.

I am not really a coder, and would be glad to pay/donate to have this snippet developed if it is not too involved. I am glad to share with community as well since I imagine that there are other people who would like to give users the ability to purchase user points using 3rd party payment services not covered by other modules such as Ubercart, ECommerce, etc...

 
 

Drupal is a registered trademark of Dries Buytaert.