Send User Email address with payer information in paypal REST API - paypal

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..

Related

Cannot get invoice in respose of CreateRecurringPaymentsProfile in paypal

My intention is to create a Recurring Profile and pass a company_id as custom parameter to be stored IPN database, where I can create a relation between payment and for which company it was done.
I have read that while creating Recurring Payment Profile to get some custom value in IPN database, you should pass it in PROFILEREFERENCE parameter and then retrieve it from rp_invoice_id in response.
I cannot get the desired output
My request:
$inputData = array(
'METHOD' => 'CreateRecurringPaymentsProfile',
'TOKEN' => $_GET['token'], //get from GetExpressCheckout
'PAYERID' => $billerInfo['PAYERID'], //from GetExpressCheckout response
'PROFILESTARTDATE' => date("Y-m-d h:i:s", strtotime("+5 seconds")), //2012-05-11T00:00:00Z #Billing date start, in UTC/GMT format
'DESC' => 'LeaveBuddy: subscription amount is $' . $bill .' for the provided service ($12 per user per year).', //#Profile description - same as billing agreement description
'BILLINGPERIOD' => 'Year', #Period of time between billings
'BILLINGFREQUENCY' => 1,#Frequency of charges
'AMT' => 10, //Todo: dynamically calculate the amt #The amount the buyer will pay in a payment period
'CURRENCYCODE' => 'USD',#The currency, e.g. US dollars
'COUNTRYCODE' => 'US',#The country code, e.g. US
'MAXFAILEDPAYMENTS' => '0',#Maximum failed payments before suspension of the profile
'PROFILEREFERENCE' => 'companyid=1', //my custom value
);
The response that I am getting is:
{"InstantPaymentNotification":{"id":"553db30b-ea1c-4f68-8b5d-4fe5cbdd56cb","notify_version":"3.8","verify_sign":"A--8MSCLabuvN8L.-MHjxC9uypBtAQZom1C7.mbS1Jv-J898ZO0eeOr9","test_ipn":"1","address_city":null,"address_country":null,"address_country_code":null,"address_name":null,"address_state":null,"address_status":null,"address_street":null,"address_zip":null,"first_name":"code","last_name":"booster","payer_business_name":null,"payer_email":"codebooster#gmail.com","payer_id":"XXXXXXXX","payer_status":"verified","contact_phone":null,"residence_country":"US","business":null,"item_name":null,"item_number":null,"quantity":null,"receiver_email":"boom#gmail.com","receiver_id":null,"custom":null,"invoice":null,"memo":null,"option_name1":null,"option_name2":null,"option_selection1":null,"option_selection2":null,"tax":"0.00","auth_id":null,"auth_exp":null,"auth_amount":null,"auth_status":null,"num_cart_items":null,"parent_txn_id":null,"payment_date":null,"payment_status":null,"payment_type":null,"pending_reason":null,"reason_code":null,"remaining_settle":null,"shipping_method":null,"shipping":"0.00","transaction_entity":null,"txn_id":"316859739","txn_type":"recurring_payment","exchange_rate":null,"mc_currency":null,"mc_fee":null,"mc_gross":10,"mc_handling":null,"mc_shipping":null,"payment_fee":null,"payment_gross":null,"settle_amount":null,"settle_currency":null,"auction_buyer_id":null,"auction_closing_date":null,"auction_multi_item":null,"for_auction":null,"subscr_date":null,"subscr_effective":null,"period1":null,"period2":null,"period3":null,"amount1":null,"amount2":null,"amount3":null,"mc_amount1":null,"mc_amount2":null,"mc_amount3":null,"recurring":null,"reattempt":null,"retry_at":null,"recur_times":null,"username":null,"password":null,"subscr_id":null,"case_id":null,"case_type":null,"case_creation_date":null,"created":"2015-04-27 03:54:51","modified":"2015-04-27 03:54:51"},"PaypalItem":[]}
So i cannot find any [rp_invoice_id] parameter here, and my invoice is also appearing null. Can any one tell me what I am missing?

How do you get the shipping address back from an Adaptive Payment API call?

How are you supposed to get the shipping info back from a Parallel Payment, using PayPal's Adaptive API system? Normally it would just get passed back as payer_country, etc - when the IPN script is requested. However, this doesn't seem to be the case.
Here are the params being passed in when the IPN script is called:
transaction[0].amount
transaction[0].id
verify_sign
transaction[1].receiver
reverse_all_parallel_payments_on_error
transaction[1].pending_reason
transaction[0].pending_reason
transaction[1].id_for_sender_txn
transaction[0].invoiceId
payment_request_date
test_ipn
cancel_url
charset
return_url
transaction[0].status_for_sender_txn
ipn_notification_url
transaction[1].is_primary_receiver
transaction[1].status
transaction_type
transaction[1].amount
transaction[0].status
log_default_shipping_address_in_transaction
transaction[0].receiver
status
transaction[0].id_for_sender_txn
action_type
fees_payer
pay_key
transaction[1].status_for_sender_txn
transaction[0].paymentType
transaction[1].invoiceId
transaction[1].id
sender_email
notify_version
transaction[1].paymentType
transaction[0].is_primary_receiver
If I then do a PaymentDetails API call, I get back stuff like:
$VAR1 = {
'currencyCode' => 'USD',
'responseEnvelope' => {
'correlationId' => '9944330ab9a8c',
'timestamp' => '2014-04-07T06:08:16.094-07:00',
'ack' => 'Success',
'build' => '10273932'
},
'status' => 'COMPLETED',
'senderEmail' => 'andy.aaaa#ultranerds.co.uk',
'cancelUrl' => 'http://somesite.net/paypal/cancel.html',
'paymentInfoList' => {
'paymentInfo' => [
{
'pendingRefund' => 'false',
'receiver' => {
'accountId' => 'NY3AD33DD739C',
'email' => 'andy-xxx#ultranerds.com',
'amount' => '65.00',
'invoiceId' => '1022',
'primary' => 'false',
'paymentType' => 'GOODS'
},
'transactionId' => '8E1114341X895213Y',
'senderTransactionStatus' => 'COMPLETED',
'senderTransactionId' => '5EV71352C33256006',
'transactionStatus' => 'COMPLETED',
'refundedAmount' => '0.00'
},
{
'pendingRefund' => 'false',
'receiver' => {
'accountId' => 'YYP5C69YWCMKE',
'email' => 'andy.yyy#gmail.com',
'amount' => '15.00',
'invoiceId' => '1023',
'primary' => 'false',
'paymentType' => 'GOODS'
},
'transactionId' => '68H86656UP574062X',
'senderTransactionStatus' => 'COMPLETED',
'senderTransactionId' => '2XW88939LK1112523',
'transactionStatus' => 'COMPLETED',
'refundedAmount' => '0.00'
}
]
},
'feesPayer' => 'EACHRECEIVER',
'actionType' => 'CREATE',
'ipnNotificationUrl' => 'http://somesite.net/paypal/test_ipn.cgi',
'sender' => {
'useCredentials' => 'false',
'accountId' => 'B74RBM5F6SLZG',
'email' => 'andy.aaa#ultranerds.co.uk'
},
'returnUrl' => 'http://somesite.net/paypal/success.html',
'payKey' => 'AP-4EK17906VB6613533',
'reverseAllParallelPaymentsOnError' => 'false'
};
As you can see, there is no reference to the delivery address at all. How are you supposed to get that info back?
UPDATE: Mmm ok, so it looks like GetShippingAddresses is what I need - but for some reason its coming back with nothing in when I call it:
{"requestEnvelope":{"errorLanguage":"en_US","detailLevel":"ReturnAll"},"key":"AP-1B1377463N9785350"} /GetShippingAddresses_API_Operation/
...simply returns:
{
'responseEnvelope' => {
'correlationId' => '3a4443aed09c9',
'timestamp' => '2014-04-07T06:40:35.460-07:00',
'ack' => 'Success',
'build' => '10273932'
}
}
I'm a bit baffled as to why its doing that. Any suggestions?
I found a quote here:
http://go.developer.ebay.com/devzone/articles/using-paypals-adaptive-payments-and-google-app-engine-build-online-market-python-part-3
Unfortunately, although this follows the process recommended by
PayPal's documentation, it doesn't work. There's currently a bug in
PayPal's Adaptive Payments implementation. For a traditional payment,
the shipping address is not collected; for embedded payments, the
GetShippingAddresses call does not return the shipping address.
PayPal has acknowledged the bug and indicated that it expects to have
this fixed in April 2011. If you need shipping addresses right now,
the recommendation is to collect them on your site rather than relying
on the PayPal API.
That was from 2011... but is this still the case??
Sorry to bump - but has anyone got any suggestions?
Ok, well I got my answer - but unfortunately its not what I was hoping for:
Yes, unfortunately this feature is only available for embedded payment
flow.
https://developer.paypal.com/webapps/developer/docs/classic/adaptive-payments/ht_ap-embeddedPayment-curl-etc/
If you're using embedded payment flow, then you can retrieve the
address on their PayPal account by passing in
senderOptions.requireShippingAddressSelection = true during
SetPaymentOption API call. You can then retrieve it via
GetShippingAddresses API call.
So it looks like really what I need to do, is ask the user to provide their shipping information BEFORE sending them to paypal, then storing it. Not ideal - but I guess you just have to work with what you got!

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
)
)

PayPal address_override integration to PayPal Express Checkout

I'm trying to set up PayPal address_override at my shop checkout as my customers have already filled in their delivery details.
I'm using express checkout, and following on from reading the documentation here: https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/formbasics/
I've got the following basic set up added into my working express checkout code (perl file):
# -- build the request for Paypal
my $response = $useragent->post($api_endpoint,
[
'METHOD' => 'SetExpressCheckout',
'VERSION' => '3.0',
'PWD' => $API_PASSWORD,
'USER' => $API_USERNAME,
'SIGNATURE' => $API_SIGNATURE,
'Amt' => $amount,
'PAYMENTACTION' => 'Sale',
'ReturnUrl' => $returnurl,
'CANCELURL' => $cancelurl,
'CURRENCYCODE' => $API_CURRENCYCODE,
'address_override' => '1',
'address1' => $d_address1,
'address2' => $d_address2,
'city' => $d_city,
'country' => $country,
'zip' => $d_post_code
]
);
However this isn't overriding the address when I get through to my PayPal account, it's still just showing my stored addresses.
I've read this post:
Paypal | Website Payment Standard | Adddress Override
And this one:
Paypal Address Override not working
Hopefully someone can show me where I'm going wrong, or if I've missed a step! Any help appreciated.
I may be wrong here but that API link you've pasted doesn't look like it's the same API that the rest of your code sample is using?
Searching for SetExpressCheckout leads to this page: https://developer.paypal.com/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/
I think you need to use the ADDROVERRIDE parameter instead of address_override and whatever else you need from that page.

Setting shipping info in OmniPay

I'm trying to set a shipping info (name,address, email, etc) using OmniPay for PayPal Express.
I've tried adding shipping info in options array in purchase($options) object:
$options = array(
// required fields (username, pass, etc)
// .....
'shippingAddress1' => 'Elm Street'
'shippingCity' => 'Elm',
'shippingPostcode' => '1000'
// etc.
);
I also tried passing this info to CreditCard object:
$card = new Omnipay\Common\CreditCard($card_options);
without any success. The code:
$gateway = GatewayFactory::create('PayPal_Express');
$gateway->setUsername(USERNAME);
$gateway->setPassword(PASS);
$gateway->setSignature(SIGNATURE);
$gateway->setTestMode(true);
$card_options = array(
'shippingAddress1' => 'Elm Street',
'shippingCity' => 'Elm',
'shippingPostcode' => '10000',
'shippingState' => '',
'shippingCountry' => 'NEverland',
'shippingPhone' => '123465789',
'company' => '',
'email' => 'shipping#test.com'
);
$card = new Omnipay\Common\CreditCard($card_options);
$response = $gateway->purchase(
array(
'cancelUrl'=>'http://localhost/laravel_paypal/',
'returnUrl'=>'http://localhost/laravel_paypal/public/paypalexpress_confirm',
'amount' => '0.99',
'currency' => 'USD',
'card' => $card
)
)->send();
How to add shipping info to PayPal Express using OmniPay?
BTW, I'm using Laravel with PayPal Sandbox.
This problem has recently been fixed (https://github.com/adrianmacneil/omnipay/pull/140) so it should now be possible to set shipping info properly.