How can i make setExpressCheckout in PayPal SOAP php
I have a problem with setExpressCheckout in PayPal. When i try GetBalance
or GetTransactionDetail all is ok. But in this code when i try make
SetExpressCheckout i have error with Version is not suported. But i think
is not about version. i was spend 4 days on try to resolve and can not :(
$client = new SoapClient('https://www.paypal.com/wsdl/PayPalSvc.wsdl', array(
'soap_version' => '106.0',
'trace' => 1,
'exceptions' => 1,
'location'=> 'https://api-3t.paypal.com/2.0/',
));
$cred = array(
'Username' => 'my username',
'Password' => 'KO23W9UJSB57HIJD',
'Signature' => 'AFcWxV21C7fd0v98TYYRCpSSRl31A7MbjiHUHOLDgv0HmrH.pJcvMr.r'
);
$Credentials = new stdClass();
$Credentials->Credentials = new SoapVar( $cred, SOAP_ENC_OBJECT,
'Credentials' );
$headers = new SoapVar( $Credentials,
SOAP_ENC_OBJECT,
'CustomSecurityHeaderType',
'urn:ebay:apis:eBLBaseComponents'
);
$client->__setSoapHeaders( new SoapHeader(
'urn:ebay:api:PayPalAPI',
'RequesterCredentials',
$headers
));
$args = array(
'Version' => '106.0',
'ReturnAllCurrencies' => '1'
);
$GetBalanceRequest = new stdClass();
$GetBalanceRequest->GetBalanceRequest = new SoapVar( $args,
SOAP_ENC_OBJECT,
'GetBalanceRequestType',
'urn:ebay:api:PayPalAPI'
);
$params = new SoapVar( $GetBalanceRequest, SOAP_ENC_OBJECT,
'GetBalanceRequest' );
$result = $client->GetBalance( $params );
echo 'Balance is: ', $result->Balance->_, ' ', $result->Balance->currencyID;
/*
This is correct and i see my bakance
*/
//set Express checkout
$args2 = array(
'OrderTotal' => '10.0 PLN',
'PaymentRequestID' => '78y3h7y8y78',
);
$PaymentDetails = new stdClass();
$PaymentDetails->PaymentDetails = new SoapVar( $args2,
SOAP_ENC_OBJECT,
'PaymentDetailsType',
'urn:ebay:api:PayPalAPI'
);
$args3 = array(
'PayPalAccountID' => '3C988uJMfU7A',
'PaymentRequestID' => '3366y66uug',
);
$SellerDetails = new stdClass();
$SellerDetails->SellerDetails = new SoapVar( $args3,
SOAP_ENC_OBJECT,
'SellerDetailsType',
'urn:ebay:api:PayPalAPI'
);
$paymentDetailsArray = array();
$paymentDetailsArray[] = $PaymentDetails->PaymentDetails;
$args1 = array(
'Version' => '106.0',
'ReturnURL' => 'linkTOsuccess',
'CancelURL' => 'linkTOcancel',
'ReqConfirmShipping' => '0',
'NoShipping' => '1',
'PaymentDetails' => $paymentDetailsArray,
);
$SetExpressCheckoutRequestDetails = new stdClass();
$SetExpressCheckoutRequestDetails->SetExpressCheckoutRequestDetails = new
SoapVar( $args1,
SOAP_ENC_OBJECT,
'SetExpressCheckoutRequestDetailsType',
'urn:ebay:api:PayPalAPI'
);
//var_dump($SetExpressCheckoutRequestDetails);
//die();
$params = new SoapVar( $SetExpressCheckoutRequestDetails, SOAP_ENC_OBJECT,
'SetExpressCheckoutRequestDetails' );
$result = $client->SetExpressCheckout( $params );
var_dump($result);
die();
And this time i have error VERSION NOT SUPORTED but it is not about
version i think
No comments:
Post a Comment