Reputation: 7945
I am using rest-api-sdk-php to make requests to Paypal. When I execute a request it looks something like this:
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-74C74934GB935960F"
I need to retrieve the token that is used to sign the request.
Is there a method in the library to get this token?
Upvotes: 0
Views: 812
Reputation: 2666
Here's the PayPal REST API SDK c# code, you'll need to translate it to PHP.
Dictionary<String, String> sdkConfig = new Dictionary<String, String>();
sdkConfig.Add("mode", "sandbox"); // when you're live, change "sandbox" to "live"
String oAuthAccessTokenForPayPal
= new PayPal.OAuthTokenCredential(yourClientID, yourSecret,
sdkConfig).GetAccessToken();
PayPal calls your password your "secret".
https://developer.paypal.com/ ... you'll need a PayPal merchant account, and a pair of id/secret for sandbox testing and a second pair for when you go live.
also, each part of your PayPal code must be wrapped with try/catch if you want your code to be robust.
Upvotes: 1