Testing the PayPal Adaptive Paymemts API in the Sandbox
I want to simulate a simple scenario with the adaptive API. A seller, buyer and my app. I created 3 test accounts in the Sandbox website:
Account named buyer - of type Personal.
Account named seller - of type Business. Account named myApp - of type Business.I am using the Adaptive Payments C#.Net code samples from paypal developers site. (The code I am using is inside csharp_nv_adaptivepayments.zip , in the Pay.cs file).
I changed sAPIUser, sAPIPassword, sAPISignature to match myApp (From API Credentialns page in SandBox site)
I changed sReceiverEmail to the seller email.
I changed sSenderEmail to the buyer email.After sending the request to https://svcs.sandbox.paypal.com/AdaptivePayments/Pay , and getting the response with sResponse = oStreamReader.ReadToEnd(); I get an OK status and I have a payKey in my hand.
Now, as the AdaptivePayments PDF says (P. 70) I need to redirect the user to https://www.paypal.com/webscr?cmd=_ap-payment&paykey=value , So I use Response.Redirect() to this url. When the browser loads the page, I get a java script error in: var sf = new PAYPAL.AP.Subflow(); Stating that "Object doesn't support this action".
I tried to change the url to http://www.sanbox.paypal....paykey=value but then I just get a white page , saying "Please login to use the PayPal Sandbox features." Also, in both cases i didn't see 开发者_C百科any payment activity in the seller,buyer logs. What am I doing wrong here ?
Yaron,
To make Live API calls, you need to obtain a Live APP ID from PayPal, For making sandbox calls, you need to properly set up the sandbox testing environment, AND be logged in to it beforehand.
This guide explains in detail what you need to do for each case:
Requires x.com free registration
http://www.x.com/servlet/JiveServlet/download/211264-21046/HelloMoney.zip
EDIT X.com died a while back. I've posted my original files in GitHub:
https://github.com/lmarkus/AdaptivePaymentsExample
精彩评论