I’m creating a site and am just adding in payments.
I’m using the Paypal SDK and have setup my SetExpressCheckout().
Here is the response,
object(SetExpressCheckoutResponseType)[72]
public 'Token' => null
public 'Timestamp' => string '2012-08-23T15:21:15Z' (length=20)
public 'Ack' => string 'Failure' (length=7)
public 'CorrelationID' => string 'e0278e8e18b4f' (length=13)
public 'Errors' =>
object(ErrorType)[78]
public 'ShortMessage' => string 'Transaction refused because of an invalid argument. See additional error messages for details.' (length=94)
public 'LongMessage' => string 'CancelURL is invalid.' (length=21)
public 'ErrorCode' => string '10472' (length=5)
public 'SeverityCode' => string 'Error' (length=5)
public 'ErrorParameters' => null
public 'Version' => string '93.0' (length=4)
public 'Build' => string '3556406' (length=7)
I’m not sure what’s up. My CancelURL looks like, urlencode('https://www.example.com/users/account/');. I’ve included the trailing slash, which some people think can cause it to be invalid.
The only thing that I can think of is that because my site isn’t online anywhere, that Paypal can’t reach the page. I have created a dummy page and uploaded it into /users/account/ on the server so it’s reachable and still nothing. I also have an entry in my etc/hosts to route example.com traffic to my localhost which worked fine for my Facebook Auth bits.
Anyone have any ideas on what the restrictions are for a CancelURL and why Paypal is kicking my request?
Request generation
$int = new PayPalAPIInterfaceServiceService();
$amount = new BasicAmountType();
$amount->currencyID = CakeSession::read('Locale.currency');
$amount->value = Configure::read('Subscription.price.'.CakeSession::read('Locale.shortname'));
$req_details_type = new SetExpressCheckoutRequestDetailsType();
$req_details_type->OrderTotal = $amount;
$req_details_type->ReturnURL = urlencode('https://www.example.com/paypal/getExpressCheckoutDetails');
$req_details_type->CancelURL = urlencode('https://www.example.com/users/account/');
$req_details_type->MaxAmount = $amount;
$req_details_type->OrderDescription = "Monthly subscription to Example.com Pro";
$req_details_type->ReqConfirmShipping = 0;
$req_details_type->NoShipping = 1;
$req_details_type->LocaleCode = CakeSession::read('Locale.shortname') == 'usa'? 'US' : 'GB';
$req_details_type->PaymentAction = 'Authorization';
$req_details_type->BuyerEmail = AuthComponent::user('email');
$req_details_type->BrandName = urlencode("Example.com");
$req_type = new SetExpressCheckoutRequestType();
$req_type->SetExpressCheckoutRequestDetails = $req_details_type;
$req = new SetExpressCheckoutReq();
$req->SetExpressCheckoutRequest = $req_type;
$response = $int->SetExpressCheckout($req);
var_dump($response);
you must change :
by :
urlencode(); is not needed here it convert you’r url into a string