|
Rank: Starting Member
Groups: Registered
Joined: 8/29/2003 Posts: 13 Location: ,
|
Hello here,
I am trying to implement MassPay API on my site with the PHP API but I am having an hard time to make it work. I am using the following script which works perfectly in the Sandbox (I am able to transfer $5 from a Sandbox account to another Sandbox account):
----------------------------------------------------------------------
$apiusername = "mytestaccount_api1.test.com";
$apipw = "[my_test_account_password]";
$certpath = "/securedirectory/cert_key_pem.txt";
$SOAPrequest = <<< End_Of_Quote
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlnssi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlnssd="http://www.w3.org/1999/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header>
<RequesterCredentials
xmlns="urn:ebay:api:PayPalAPI"
SOAP-ENV:mustUnderstand="1">
<Credentials xmlns="urn:ebay:apis:eBLBaseComponents">
<Username>$apiusername</Username>
<Password>$apipw</Password>
<Subject/>
</Credentials>
</RequesterCredentials>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<MassPayReq xmlns="urn:ebay:api:PayPalAPI">
<MassPayRequest xsi:type="ns:MassPayRequestType">
<Version xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="xsd:string">1.0</Version>
<EmailSubject xsi:type="xsd:string">Your payment is here!</EmailSubject>
<MassPayItem xsi:type="ns:MassPayRequestItemType">
<ReceiverEmail xsi:type="ns:EmailAddressType">test@test.com</ReceiverEmail>
<Amount currencyID="USD" xsl:type="cc:BasicAmountType">5.00</Amount>
<Note xsl:type="xsd:string">This is your payment.</Note>
</MassPayItem>
</MassPayRequest>
</MassPayReq>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
End_Of_Quote;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://api.sandbox.paypal.com/2.0/");
curl_setopt($ch, CURLOPT_SSLCERT, $certpath);
curl_setopt($ch, CURLOPT_POSTFIELDS, $SOAPrequest);
curl_exec ($ch);
if (curl_error($ch))
printf("Error %s: %s", curl_errno($ch), curl_error($ch));
curl_close ($ch);
----------------------------------------------------------------------
then I use the same script on my live environment as following:
----------------------------------------------------------------------
$apiusername = "[my_live_API_username]";
$apipw = "[my_live_API_password]";
$certpath = "/securedirectory/cert_key_pem.txt";
$SOAPrequest = <<< End_Of_Quote
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlnssi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlnssd="http://www.w3.org/1999/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header>
<RequesterCredentials
xmlns="urn:ebay:api:PayPalAPI"
SOAP-ENV:mustUnderstand="1">
<Credentials xmlns="urn:ebay:apis:eBLBaseComponents">
<Username>$apiusername</Username>
<Password>$apipw</Password>
<Subject/>
</Credentials>
</RequesterCredentials>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<MassPayReq xmlns="urn:ebay:api:PayPalAPI">
<MassPayRequest xsi:type="ns:MassPayRequestType">
<Version xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="xsd:string">1.0</Version>
<EmailSubject xsi:type="xsd:string">Your payment is here!</EmailSubject>
<MassPayItem xsi:type="ns:MassPayRequestItemType">
<ReceiverEmail xsi:type="ns:EmailAddressType">[my_real_personal_PayPal_account_email]</ReceiverEmail>
<Amount currencyID="USD" xsl:type="cc:BasicAmountType">5.00</Amount>
<Note xsl:type="xsd:string">This is your payment.</Note>
</MassPayItem>
</MassPayRequest>
</MassPayReq>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
End_Of_Quote;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://api-3t.paypal.com/2.0/");
curl_setopt($ch, CURLOPT_SSLCERT, $certpath);
curl_setopt($ch, CURLOPT_POSTFIELDS, $SOAPrequest);
curl_exec ($ch);
if (curl_error($ch))
printf("Error %s: %s", curl_errno($ch), curl_error($ch));
curl_close ($ch);
----------------------------------------------------------------------
and I get an error.
Whereas by using the Sandbox fake accounts everything works fine and I get the following result:
2006-06-08T16:40:04ZSuccesseff75340bcb3f1.0000001.0006
with the live version i get the following error:
2006-06-08T16:40:30ZFailurec9d5c76d2a114Security errorSecurity header is not valid10002Error1.0000001.0006
Any idea? Any help is very welcome. Thank you in advance.
Sincerely,
Fabrizio
Virtual Sheet Music - Classical Sheet Music Downloads
http://www.virtualsheetmusic.com
|
|
Rank: Starting Member
Groups: Registered
Joined: 8/13/2005 Posts: 23 Location: ,
|
are you using the same certificate for both? your live certificate is different than sandbox certificate
|