Jump to content


Photo

MassPay API works in Sandbox but not live!


  • This topic is locked This topic is locked
1 reply to this topic

#1 fabrizio

fabrizio

    Member

  • Members
  • PipPip
  • 13 posts

Posted 08 June 2006 - 10:08 AM

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

#2 PayPal_Damon

PayPal_Damon

    Member

  • Members
  • PipPip
  • 23 posts

Posted 08 June 2006 - 12:57 PM

are you using the same certificate for both? your live certificate is different than sandbox certificate




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users