Payee account is invalid. #PAYEE_ACCOUNT_INVALID - paypal

I am trying to implement PayPal Credit card functionality on Laravel for Rest Api. I am receiving the "PAYEE_ACCOUNT_INVALID" error. Any idea what am I doing wrong? Any help would be really appreciated.
I've tried with different test card numbers provided by PayPal via card generator mock.
Thanks.
This is my code snippet.
public function payment()
{
$gateway = Omnipay::create('PayPal_Rest');
// Initialise the gateway
$gateway->initialize(array(
'clientId' => env('PAYPAL_SANDBOX_CLIENT_ID'),
'secret' => env('PAYPAL_SANDBOX_CLIENT_SECRET'),
'testMode' => true,
));
#### Direct Credit Card Payment
// Create a credit card object
// DO NOT USE THESE CARD VALUES -- substitute your own
// see the documentation in the class header.
$card = new CreditCard([
'firstName' => 'Example',
'lastName' => 'User',
'number' => '4111111111111111',
'expiryMonth' => '01',
'expiryYear' => '2027',
'cvv' => '123',
]);
// Do a purchase transaction on the gateway
try {
$transaction = $gateway->purchase([
'amount' => '1.00',
'currency' => 'AUD',
'description' => 'This is a test purchase transaction.',
'card' => $card,
]);
$response = $transaction->send();
$data = $response->getData();
echo "Gateway purchase response data == " . print_r($data, true) . "\n";
if ($response->isSuccessful()) {
echo "Purchase transaction was successful!\n";
}
} catch (Exception $e) {
echo "Exception caught while attempting authorize.\n";
echo "Exception type == " . get_class($e) . "\n";
echo "Message == " . $e->getMessage() . "\n";
}
}

Payee account invalid means the receiving account cannot process the transaction. Most likely this is a deprecated integration method, although it is hard to say without seeing the actual API request and response.
The current way to process credit cards is with the PayPal Checkout SDK, which has a black debit or credit card button that expands a form on your site. Optionally there is an Advanced integration that can be added on for presenting the card fields in a more customized way; it's more work to implement.

Related

Can we update the credit card detail using braintree update method without card number of the user?

I have to update the credit card information of the user in my project using braintree update method.
The code segment of my controller for the updation of the card is below -
case 'update':
$expirationMonth = $this->input->post('expiration_month');
$expirationYear = $this->input->post('expiration_year');
if (!empty($expirationMonth) && !empty($expirationYear)) {
if (date('Y') > $expirationYear) {
die('expired');
} else if ($expirationYear == date('Y')) {
if (date('m') > $expirationMonth)
die('expired');
}
}
$cardId = $this->input->post('cardId');
$cardNumber = $this->input->post('card_num');
$streetAddress = $this->input->post('street_add');
$cardCity = $this->input->post('card_city');
$cardState = $this->input->post('card_state');
$postalCode = $this->input->post('postal_code');
$customerId = $this->input->post('customer_id');
$vaultToken = $this->input->post('vault_token');
$cvvCode = $this->input->post('cvv_code');
$data['default_status'] = $this->input->post('default_status');
$data['card_type'] = $this->input->post('cardType');
$this->load->library("braintreelib");
$result = Braintree_Customer::update($customerId, array(
//we can create a credit card at the same time
'creditCard' => array(
//'cardholderName' => $this->input->post('cardholder_name'),
//'number' => $cardNumber,
'expirationMonth' => $expirationMonth,
'expirationYear' => $expirationYear,
'cvv' => $cvvCode,
'billingAddress' => array(
/* Optional Information you can supply */
'streetAddress' => $streetAddress,
'locality' => $cardCity,
'region' => getUsStateName($cardState)->abbrev,
'postalCode' => $postalCode,
),
'options' => array('verifyCard' => true)
)
));
if (isset($cardId)) {
if($result->success){
$this->load->model('updatedetails_model');
if($data['default_status']){
$this->common->saveDetails(TBL_RS_PAYMENTDETAILS, array('default_status' => 0, 'card_type' => $cardType), array('currentuserid' => $currentUserId, 'currentroleid' => $this->input->post('roleId')));
}
$cardDetailId = $this->updatedetails_model->addedit_carddetails($data, $cardId);
if (!$cardDetailId) {
echo 'error';
exit;
}
}else{
foreach ($result->errors->deepAll() as $error) {
$errorFound = $error->message . "<br />";
}
//echo $errorFound ;
echo $errorFound;
exit;
}
} else {
echo 'invalidcarddetails';
exit;
}
$details['carddetails'] = $this->profile->getUserCardDetailsByUserId($currentUserId);
foreach($details['carddetails'] as $index => $value){
$paymentMethod = Braintree_PaymentMethod::find(base64_decode($value->vault_token));
$details['carddetails'][$index]->lastDigit = $paymentMethod->last4;
$details['carddetails'][$index]->cardType = $paymentMethod->cardType;
$details['carddetails'][$index]->cardholderName = ucfirst($paymentMethod->cardholderName);
}
$this->data['carddetails'] = $details['carddetails'];
echo $b = $this->load->view('operatorCardListing', $this->data, TRUE);
break;
When I am trying to run this code, I am getting the error -
Credit card must include number, paymentMethodNonce, or venmoSdkPaymentMethodCode.
My requirement is to update the credit card information without putting the card number.
Is it possible to update the card without credit card number ?
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
You are able to update a credit card without specifying a credit card number. Braintree recommends doing this with the payment method functions instead of the credit card object to help you avoid handling raw credit card data on your website.
In the code that you've posted, you're making a customer update call rather than a credit card update call. When you make your customer update call, you're sending an array of credit cards. Braintree will try to update the customer by adding the cards in that array to the customer's record. The customer update call does not signal to the gateway that the cards on the customer should be updated. Rather than a customer update call, you'll want to use a [payment method update call][pm_upadte].
To update only a portion of the card, such as changing only the expiration date or CVV, you can use a payment method nonce. Create a payment method nonce by tokenizing only the details that you want to change. Once you have a nonce that only references the details you want to change, you can pass that into a payment method update call. This is what it might look like in php:
$result = Braintree_PaymentMethod::update('the_token', [
'paymentMethodNonce' => 'nonce_from_your_client'
]);

How to set up Omnipay with Laravel?

I am using this packet:
https://github.com/barryvdh/laravel-omnipay
In my controller I added:
$params = [
'amount' => '10',
'issuer' => 22,
'description' => 'desc',
'returnUrl' => URL::action('PurchaseController#returnApi', [43]),
];
$response = Omnipay::purchase($params)->send();
if ($response->isSuccessful()) {
// payment was successful: update database
print_r($response);
} elseif ($response->isRedirect()) {
// redirect to offsite payment gateway
return $response->getRedirectResponse();
} else {
// payment failed: display message to customer
echo $response->getMessage();
}
Here is my omnipay.php conf file:
<?php
return array(
/** The default gateway name */
'gateway' => 'PayPal_Express',
/** The default settings, applied to all gateways */
'defaults' => array(
'testMode' => true,
),
/** Gateway specific parameters */
'gateways' => array(
'PayPal_Express' => array(
'username' => '',
'landingPage' => array('billing', 'login'),
),
),
);
But get this error:
call_user_func_array() expects parameter 1 to be a valid callback,
class 'Omnipay\Common\GatewayFactory' does not have a method
'purchase'
Anyone can help me set this?
I created app on paypal and have details about it but don't know how to set it with this API...
I recommend that you switch from PayPal Express to PayPal REST. It is newer and has better documentation.
I have looked through the laravel-omnipay package and I can't see a use case for it. I would just code to the omnipay package directly.
I recommend that you create a unique transaction ID for each transaction and provide that as part of the URLs for returnUrl and cancelUrl so that you can identify which transaction you are dealing with in the return and cancel handlers.
I think that you are taking the examples in the laravel-omnipay package too literally. You don't need or want those echo statements there. You should be capturing the response from purchase() even if it is a redirectResponse and doing a getTransactionReference() check on it, because you will need that transaction reference later, e.g. for transaction lookup. You should store it in the transaction record that you created before calling purchase().
You may use
use Omnipay\Omnipay;
in your controller, change it to
use Omnipay;

Send User Email address with payer information in paypal REST API

hi friends i am using paypal REST API in my eCommerce website. all are works fine. what i need is, i have to send user email with cart and payer information to store it in paypal. how can i do this?
$items[] = array(
'name' => $product_name,
'quantity' => 1,
'price' => $cart_item['amount'],
'sku' => $current['uid'],
'currency' => 'USD'
);
$credit_card = array(
'type'=> $cc_card_type,
'number' => $cc_card_number,
'expire_month'=>$cc_card_month,
'expire_year'=>$cc_card_year,
'cvv2'=>$cc_card_cvv2,
'first_name'=>$cc_first_name,
'last_name'=>$cc_last_name
);
$result = pay_direct_with_credit_card($credit_card, PP_CURRENCY , $total_amount, $items, $payment_desc) ;
You can do that by providing payer_info object
See:
Payment Object > Payer > payer_info object
Hth..

How to get paykey using Paypal Adeptive and make successful checkout in checkout?

i am using paypal adaptive parallel payments using light box so that user resides on my own site without redirections.
I am simply want when i click on payment button i will get dynamic key in the form and so on the posting form lightbox opens up and i gets payment from sender and split the money in 2 accounts.
paypal business account:
mohsin#balianti.com that is my site admin account as well. who will receive 10% from total amount.
sanbox account that i created in mohsin#balianti.com sandbox account options: mmskit#outlook.com that will receive 90% of total money.
so mohsin#balianti.com as a site admin and holding business account will receive 10% while other receiver will receive 90%.
means total money will split in both accounts.
hope you will got my point.
the problem is that:
1- i am not getting paykey from paypal.
2- i am unable to do the transaction in light box.
3- i am unable to slipt the money in 2 receivers and so unable to complete to process.
My HTML Code:
<html>
<head>
<script src="https://www.paypalobjects.com/js/external/dg.js" type="text/javascript"></script>
</head>
<body>
<!--https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay?expType=light&payKey=AP-5S482348KH512131U-->
<form action="https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay?expType=light&payKey=NOT KNOW HOW TO GET THIS PAY KEY ON THE BUTTON CLICK" target="PPDGFrame" class="standard">
<label for="buy">Buy Now:</label>
<input type="image" id="submitBtn" value="Pay with PayPal" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif">
</form>
<script type="text/javascript" charset="utf-8">
var embeddedPPFlow = new PAYPAL.apps.DGFlow({trigger: 'submitBtn'});
</script>
</body>
</html>
My Config.php file:
<?php
/**
* Timezone Setting
* List of Supported Timezones: http://www.php.net/manual/en/timezones.php
*/
date_default_timezone_set('America/Chicago');
/**
* Enable Sessions
* Checks to see if a session_id exists. If not, a new session is started.
*/
if(!session_id()) session_start();
/**
* Sandbox Mode - TRUE/FALSE
* Check the domain of the current page and set $sandbox accordingly.
* This allows you to automatically use Sandbox or Live credentials throughout
* your application based on what server the app is running from.
*
* I like to do this so I don't forget to update Sandbox credentials to Live
* prior to uploading files to a production server.
*
* In this case, it's checking to see if the current URL is http://sandbox.domain.*
* If so, $sandbox is true and the PayPal sandbox will be used throughout. If not,
* we'll assume it must be a live transaction and will use live credentials throughout.
*
* Following this pattern will allow you to create your own http://sandbox.domain.com test server,
* and then any time your code runs from that server, PayPal's sandbox will be used automatically.
*
* If you would rather just set $sandbox to true/false on your own that's fine,
* but you have to make sure your live server always uses false and your test server
* always uses true. It's easy to forget this and up with real customers processing
* payments from your live site on the PayPal sandbox.
*/
$host_split = explode('.',$_SERVER['HTTP_HOST']);
$sandbox = $host_split[0] == 'sandbox' && $host_split[1] == 'domain' ? TRUE : FALSE;
$domain = $sandbox ? 'http://sandbox.domain.com/' : 'http://lahori.org/mydev/themusicnetwork/';
/**
* Enable error reporting if running in sandbox mode.
*/
if($sandbox)
{
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', '1');
}
/*
* PayPal API Version
* ------------------
* The library is currently using PayPal API version 109.0.
* You may adjust this value here and then pass it into the PayPal object when you create it within your scripts to override if necessary.
*/
$api_version = '109.0';
/*
* PayPal Application ID
* --------------------------------------
* The application is only required with Adaptive Payments applications.
* You obtain your application ID but submitting it for approval within your
* developer account at http://developer.paypal.com
*
* We're using shorthand if/else statements here to set both Sandbox and Production values.
* Your sandbox values go on the left and your live values go on the right.
* The sandbox value included here is a global value provided for developrs to use in the PayPal sandbox.
*/
$application_id = $sandbox ? 'APP-80W284485P519543T' : '';
/*
* PayPal Developer Account Email Address
* This is the email address that you use to sign in to http://developer.paypal.com
*/
$developer_account_email = 'mohsin#balianti.com';
/*
* PayPal Gateway API Credentials
* ------------------------------
* These are your PayPal API credentials for working with the PayPal gateway directly.
* These are used any time you're using the parent PayPal class within the library.
*
* We're using shorthand if/else statements here to set both Sandbox and Production values.
* Your sandbox values go on the left and your live values go on the right.
*
* You may obtain these credentials by logging into the following with your PayPal account: https://www.paypal.com/us/cgi-bin/webscr?cmd=_login-api-run
*/
$api_username = $sandbox ? 'mohsin_api1.balianti.com' : 'LIVE_API_USERNAME';
$api_password = $sandbox ? 'DAQQ3QK5LTHHWGYV' : 'LIVE_API_PASSWORD';
$api_signature = $sandbox ? 'Ad9JZLf8.13dlHmFgFft2NVbaPK4AvTXPIYEMvf.CyBXiGxnrmbQG4l2' : 'LIVE_API_SIGNATURE';
/*
* Payflow Gateway API Credentials
* ------------------------------
* These are the credentials you use for your PayPal Manager: http://manager.paypal.com
* These are used when you're working with the PayFlow child class.
*
* We're using shorthand if/else statements here to set both Sandbox and Production values.
* Your sandbox values go on the left and your live values go on the right.
*
* You may use the same credentials you use to login to your PayPal Manager,
* or you may create API specific credentials from within your PayPal Manager account.
*/
$payflow_username = $sandbox ? 'SANDBOX_PAYFLOW_USERNAME' : 'LIVE_PAYFLOW_USERNAME';
$payflow_password = $sandbox ? 'SANDBOX_PAYFLOW_PASSWORD' : 'LIVE_PAYFLOW_PASSWORD';
$payflow_vendor = $sandbox ? 'SANDBOX_PAYFLOW_VENDOR' : 'LIVE_PAYFLOW_VENDOR';
$payflow_partner = $sandbox ? 'SANDBOX_PAYFLOW_PARTNER' : 'LIVE_PAYFLOW_PARTNER';
/*
* PayPal REST API Credentials
* ---------------------------
* These are the API credentials used for the PayPal REST API.
* These are used any time you're working with the REST API child class.
*
* You may obtain these credentials from within your account at http://developer.paypal.com
*/
$rest_client_id = $sandbox ? 'AUjqAhB6ZWMudj58C_NAC0kA58EmNCl2LPFlmaX76t1e0kVu-GwALjzVTBwR' : 'LIVE_CLIENT_ID';
$rest_client_secret = $sandbox ? 'EPXlgBAIfaptG15JI7OxxZK1GNxgfAqQg5uhmllzdF1FIE5hjEhsIBbrwfbV' : 'LIVE_SECRET_ID';
/*
* PayPal Finance Portal API
* -------------------------
* These are credentials used for obtaining a PublisherID used in Bill Me Later Banner code.
* As of now, these are specialized API's and you must obtain credentials directly from a PayPal rep.
*/
$finance_access_key = $sandbox ? 'SANDBOX_ACCESS_KEY' : 'LIVE_ACCESS_KEY';
$finance_client_secret = $sandbox ? 'SANDBOX_CLIENT_SECRET' : 'LIVE_CLIENT_SECRET';
/**
* Third Party User Values
* These can be setup here or within each caller directly when setting up the PayPal object.
*/
$api_subject = ''; // If making calls on behalf a third party, their PayPal email address or account ID goes here.
$device_id = '';
$device_ip_address = $_SERVER['REMOTE_ADDR'];
?>
My PHP Code i get from angel's eye paypal class:
<?php
// Include required library files.
require_once('config.php');
require_once('paypal.class.php');
require_once('paypal.adaptive.class.php');
// Create PayPal object.
$PayPalConfig = array(
'Sandbox' => $sandbox,
'DeveloperAccountEmail' => $developer_account_email,
'ApplicationID' => $application_id,
'DeviceID' => $device_id,
'IPAddress' => $_SERVER['REMOTE_ADDR'],
'APIUsername' => $api_username,
'APIPassword' => $api_password,
'APISignature' => $api_signature,
'APISubject' => $api_subject
);
$PayPal = new PayPal_Adaptive($PayPalConfig);
// Prepare request arrays
$PayRequestFields = array(
'ActionType' => 'PAY', // Required. Whether the request pays the receiver or whether the request is set up to create a payment request, but not fulfill the payment until the ExecutePayment is called. Values are: PAY, CREATE, PAY_PRIMARY
'CancelURL' => $domain.'cancel.php', // Required. The URL to which the sender's browser is redirected if the sender cancels the approval for the payment after logging in to paypal.com. 1024 char max.
'CurrencyCode' => 'USD', // Required. 3 character currency code.
'FeesPayer' => 'EACHRECEIVER', // The payer of the fees. Values are: SENDER, PRIMARYRECEIVER, EACHRECEIVER, SECONDARYONLY
'IPNNotificationURL' => '', // The URL to which you want all IPN messages for this payment to be sent. 1024 char max.
'Memo' => '', // A note associated with the payment (text, not HTML). 1000 char max
'Pin' => '', // The sener's personal id number, which was specified when the sender signed up for the preapproval
'PreapprovalKey' => '', // The key associated with a preapproval for this payment. The preapproval is required if this is a preapproved payment.
'ReturnURL' => $domain.'return.php', // Required. The URL to which the sener's browser is redirected after approvaing a payment on paypal.com. 1024 char max.
'ReverseAllParallelPaymentsOnError' => '', // Whether to reverse paralel payments if an error occurs with a payment. Values are: TRUE, FALSE
'SenderEmail' => '', // Sender's email address. 127 char max.
'TrackingID' => '' // Unique ID that you specify to track the payment. 127 char max.
);
$ClientDetailsFields = array(
'CustomerID' => '', // Your ID for the sender 127 char max.
'CustomerType' => '', // Your ID of the type of customer. 127 char max.
'GeoLocation' => '', // Sender's geographic location
'Model' => '', // A sub-identification of the application. 127 char max.
'PartnerName' => 'Always Give Back' // Your organization's name or ID
);
$FundingTypes = array('ECHECK', 'BALANCE', 'CREDITCARD');
$Receivers = array();
$Receiver = array(
'Amount' => '10.00', // Required. Amount to be paid to the receiver.
'Email' => 'mohsin#balianti.com', // Receiver's email address. 127 char max.
'InvoiceID' => '', // The invoice number for the payment. 127 char max.
'PaymentType' => 'GOODS', // Transaction type. Values are: GOODS, SERVICE, PERSONAL, CASHADVANCE, DIGITALGOODS
'PaymentSubType' => '', // The transaction subtype for the payment.
'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => ''), // Receiver's phone number. Numbers only.
'Primary' => 'TRUE' // Whether this receiver is the primary receiver. Values are boolean: TRUE, FALSE
);
array_push($Receivers,$Receiver);
$Receiver = array(
'Amount' => '5.00', // Required. Amount to be paid to the receiver.
'Email' => 'mmskit#outlook.com', // Receiver's email address. 127 char max.
'InvoiceID' => '', // The invoice number for the payment. 127 char max.
'PaymentType' => 'GOODS', // Transaction type. Values are: GOODS, SERVICE, PERSONAL, CASHADVANCE, DIGITALGOODS
'PaymentSubType' => '', // The transaction subtype for the payment.
'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => ''), // Receiver's phone number. Numbers only.
'Primary' => 'false' // Whether this receiver is the primary receiver. Values are boolean: TRUE, FALSE
);
array_push($Receivers,$Receiver);
$SenderIdentifierFields = array(
'UseCredentials' => '' // If TRUE, use credentials to identify the sender. Default is false.
);
$AccountIdentifierFields = array(
'Email' => '', // Sender's email address. 127 char max.
'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => '') // Sender's phone number. Numbers only.
);
$PayPalRequestData = array(
'PayRequestFields' => $PayRequestFields,
'ClientDetailsFields' => $ClientDetailsFields,
'FundingTypes' => $FundingTypes,
'Receivers' => $Receivers,
'SenderIdentifierFields' => $SenderIdentifierFields,
'AccountIdentifierFields' => $AccountIdentifierFields
);
// Pass data into class for processing with PayPal and load the response array into $PayPalResult
$PayPalResult = $PayPal->Pay($PayPalRequestData);
if(!$this->paypal_adaptive->APICallSuccessful($PayPalResult['Ack']))
{
$errors = array('Errors'=>$PayPalResult['Errors']);
// Write the contents of the response array to the screen for demo purposes.
echo '<pre />';
print_r($errors);
exit();
}
else
{
header('Location: '.$PayPalResult['RedirectURL']);
$ExecutePaymentFields = array(
'PayKey' => $PayPalResult['PayKey'],
'FundingPlanID' => ''
);
$PayPalRequestData = array('ExecutePaymentFields' => $ExecutePaymentFields);
$PayPalResult = $PayPal->ExecutePayment($PayPalRequestData);
if(!$PayPalResult)
{
$errors = array('Errors'=>$PayPalResult['Errors']);
echo '<pre />';
print_r($errors);
exit();
}
else
{
echo '<pre />';
print_r($PayPalResult);
}
}
if($PayPal->APICallSuccessful($PayPalResult['Ack']))
{
// Redirect to PayPal so user can complete payment.
header('Location: '.$PayPalResult['RedirectURL']);
}
else
{
// Error
echo '<pre />';
print_r($PayPalResult['Errors']);
exit();
}
?>
my login information and whole detailed level information i received from paypal.
REST API CREDENTIALS
Test credentials
Your test credentials are enabled for all features in your app.
Test account:
mohsin-facilitator#balianti.com
Endpoint: api.sandbox.paypal.com
Client ID: AUjqAhB6ZWMudj58C_NAC0kA58EmNCl2LPFlmaX76t1e0kVu-GwALjzVTBwR
Secret: EPXlgBAIfaptG15JI7OxxZK1GNxgfAqQg5uhmllzdF1FIE5hjEhsIBbrwfbV
Here is your API signature:
API Username: mohsin_api1.balianti.com
API Password: DAQQ3QK5LTHHWGYV
Signature: Ad9JZLf8.13dlHmFgFft2NVbaPK4AvTXPIYEMvf.CyBXiGxnrmbQG4l2
Copy and paste the PayPal settings above into the API/Integration section of your Magento Configuration page.
You have successfully saved your preferences. Please use the following identity token when setting up Payment Data Transfer on your website.
A9XxF-vXyH3-kPYVX0dDDcojmBxvMidXnmn846gxQD0ehzXM4Xjva0VL6RW
http://developer.paypal.com
mohsin#balianti.com
m#h$!nBali
please please help me resolving the whole issue. i am waiting for serious replies please.
Thank You All.
I took your code and ran it on my server here.
The first thing I notice is that you have everything commented out below the $PayPalResult getting loaded, so you didn't have anything actually happening with that result. No output to screen or back to the requesting client.
When I run it with my credentials and look at the actual result, this is what I'm getting.
[Errors] => Array
(
[0] => Array
(
[Receiver] =>
[Category] => Application
[Domain] => PLATFORM
[ErrorID] => 520009
[ExceptionID] =>
[Message] => Account mohsin#balianti.com is restricted
[Parameter] => mohsin#balianti.com
[Severity] => Error
[Subdomain] => Application
)
)
[Ack] => Failure
[Build] => 10273932
[CorrelationID] => 471e9fbfa0053
[Timestamp] => 2014-03-29T09:45:56.631-07:00
So it seems that there is something wrong with the receiver account you're using on this. When I look into that more I see that you've got the same receiver set as both a primary and a secondary receiver on this same payment.
Once I replaced your receiver email address with 2 separate emails from my own sandbox accounts, I got a successful response.
[Ack] => Success
[Build] => 10273932
[CorrelationID] => 9afd1342ebf17
[Timestamp] => 2014-03-29T09:50:00.472-07:00
[PayKey] => AP-8FY50816521434738
[PaymentExecStatus] => CREATED
So then I went back and tried your account as a receiver along with one of my accounts, but I wound up with the same error about the account being restricted.
So, I'm not sure why that account would be restricted, especially on the sandbox. It doesn't look like a sandbox email account, though. Is it one? You need to make sure you're using sandbox accounts when testing on the sandbox.
If you're actually hitting the live server and getting the same error then you'll need to contact PayPal for help with what's wrong with that account.
You may be getting a different error, though, if you're running live. To check that you need to look at the actual result that is coming back to $PayPalResult. Again, you've got all of that commented out in your code, so it wouldn't even be returning a result back to your client request.
please see.:
Array
(
[Errors] => Array
(
[0] => Array
(
[Receiver] =>
[Category] => Application
[Domain] => PLATFORM
[ErrorID] => 580022
[ExceptionID] =>
[Message] => Invalid request parameter: payKey cannot be null
[Parameter] => payKey
[Severity] => Error
[Subdomain] => Application
)
)
[Ack] => Failure
[Build] => 10273932
[CorrelationID] => 2d63bc22401c7
[Timestamp] => 2014-04-15T02:27:08.040-07:00
[PaymentExecStatus] =>
[XMLRequest] => ReturnAllen_US
[XMLResponse] => 2014-04-15T02:27:08.040-07:00Failure2d63bc22401c710273932580022PLATFORMApplicationErrorApplicationInvalid request parameter: payKey cannot be nullpayKeynull
)
odftetretArray
(
[0] => Array
(
[Receiver] =>
[Category] => Application
[Domain] => PLATFORM
[ErrorID] => 580022
[ExceptionID] =>
[Message] => Invalid request parameter: payKey cannot be null
[Parameter] => payKey
[Severity] => Error
[Subdomain] => Application
)
)

Omnipay / Paypal Gateway - Transaction shows as success whereas Paypal Sandbox account do not show debt/credit of the transaction

1) I am triying for a while to get Omnipay / Paypal to work. My issue is I get "ACK = Success" but when going into the Sandbox test accounts, neither the buyer nor seller shows the transaction as booked.
2) I also got the feeling not all APIs are correctly transferred to Paypal (e.g. Brandname shows correctly using Angell library but with Omnipay it doesn't take the variable.
Anybody who can help on those two issues.? - See my code below. I checked other articles here, they don't solve my problem.
<?php
//
// Input Variables
//
// Config
$domain = "http://localhost";
$directory = "http://localhost/omnipay/";
$returnURL = $directory."success.php";
$cancelURL = $directory."cancel.php";
$landingpage = "Billing";
$brandname = "TEST COMPANY";;
$customerservicenumber = "";
// Purchase Data
$invoiceNumber = "0000200202023939";
$currencyCode = "USD";
// PRODUCT DATA
$subscriptionName = "XXX";
$subscriptionDesc = "ZZZ";
$subscriptionAmt = "5.00";
require 'vendor/autoload.php';
use Omnipay\Omnipay;
$gateway = Omnipay::create('PayPal_Express');
$gateway->setUsername('XXX');
$gateway->setPassword('XXX');
$gateway->setSignature('XXX');
$gateway->setTestMode(true);
$response = $gateway->purchase(
array(
// Settings
'brandname' => '',
'customerservicenumber'=> '',
'cancelURL' => $cancelURL,
'returnURL' => $returnURL,
'reqconfirmshipping' => '0',
'noshipping' => '1',
'allownote' => '0',
// Buyer data
'email' => $email,
'description'=> $subscriptionDesc,
'amount'=> $subscriptionAmt,
'currency'=> $currencyCode,
)
)->send();
$response->redirect();
?>
success.php is the same script, except for the end
....
)->send();
$data = $response->getData();
//echo '<pre>'; print_r($data);
if($data['ACK'] == "Success"){
echo "ACK = Success!!!!!!";
}
?>
As said, I always got ACK = Success at the end, but the amounts are not deducted from the Sandbox user accounts. So something is wrong. Any idea?
It looks like you're not completing the purchase. Your success.php should have something that looks like:
$response = $gateway->completePurchase($params)->send();
Before you redirect off to Paypal save your transaction parameters in a session variable and then use them to complete the purchase when Paypal returns. Check out the example code for more details: https://github.com/omnipay/example/blob/master/index.php#L181