PayPal address_override integration to PayPal Express Checkout - perl

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.

Related

Paypal Refund NVP API : You do not have permission to refund this transaction

i Am using Paypal NVP Refund Api For Refund Paypal Transaction.
All Things are ok but when i try to rung api, it gives me below Response.
Array
(
[TIMESTAMP] => 2017-07-17T13:58:24Z
[CORRELATIONID] => xxxxxxxxxx
[ACK] => Failure
[VERSION] => 51.0
[BUILD] => 36458220
[L_ERRORCODE0] => 10007
[L_SHORTMESSAGE0] => Permission denied
[L_LONGMESSAGE0] => You do not have permission to refund this transaction
[L_SEVERITYCODE0] => Error
)
is that some process i miss to call.?
After giving permission same issue exists.
Then I found I missed an argument..
I'm sending this request.
$nvpreq = array(
'USER' => '',
'PWD' => '',
'SIGNATURE' => '',
'METHOD'=> 'RefundTransaction',
'VERSION' => urlencode('94'),
'TRANSACTIONID' => 'xxxxxxxx',
'REFUNDTYPE' => 'Partial',
'AMT' => '0.01',
'CURRENCYCODE' => 'USD');
I forgot to add 'SUBJECT' => 'reiceversemail#gmail.com',.
Now it is working.
Here is the some causes of this error.
You used the wrong transaction ID.
You're trying to make the call for a third party and have the wrong
email address in the subject.
The subject account hasn't given you permission to make the
third-party call.
Here is link you can check this. Why did I get API error code 10007?

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

paypal error processing payment bmcreatebutton

I am creating Paypal buttons on the fly for shopping cart processing. I've used Express Checkout with no issues but the client does not want customers to have to complete the billing details on the EC page, using Hosted Payment buttons seems to be the solution.
I create the button using the NVP code sending the following:
(
[L_BUTTONVAR0] => business=emailaddress
[L_BUTTONVAR1] => paymentaction=sale
[L_BUTTONVAR2] => currency_code=AUD
[L_BUTTONVAR3] => cancel_return=http://localhost/orders/view/335774
[L_BUTTONVAR4] => notify_url=http://localhost/orders/complete_hostedpaypal/335774
[L_BUTTONVAR5] => return=http://localhost/orders/view/335774
[L_BUTTONVAR6] => invoice=Order #335774
[L_BUTTONVAR7] => subtotal=167.40
[L_BUTTONVAR8] => tax=2
[L_BUTTONVAR9] => shipping=3
[L_BUTTONVAR10] => handling=4
[L_BUTTONVAR11] => template=templateC
[L_BUTTONVAR12] => first_name=TEST
[L_BUTTONVAR13] => last_name=ORDER
[L_BUTTONVAR14] => buyer_email=emailaddress
[L_BUTTONVAR15] => address1=PO Box 2633
[L_BUTTONVAR16] => address2=
[L_BUTTONVAR17] => city=TAREN POINT
[L_BUTTONVAR18] => state=NSW
[L_BUTTONVAR19] => country=AU
[L_BUTTONVAR20] => zip=2229
[L_BUTTONVAR21] => billing_first_name=TEST
[L_BUTTONVAR22] => billing_last_name=ORDER
[L_BUTTONVAR23] => billing_address1=PO Box 2633
[L_BUTTONVAR24] => billing_address2=
[L_BUTTONVAR25] => billing_city=TAREN POINT
[L_BUTTONVAR26] => billing_state=NSW
[L_BUTTONVAR27] => billing_country=AU
[L_BUTTONVAR28] => billing_zip=2229
[L_BUTTONVAR29] => showBillingAddress=false
[L_BUTTONVAR30] => showShippingAddress=false
[L_BUTTONVAR31] => address_override=false
[L_BUTTONVAR32] => bn=AUD
[L_BUTTONVAR33] => lc=AU
[METHOD] => BMCreateButton
[BUTTONCODE] => TOKEN
[BUTTONTYPE] => PAYMENT
[USER] => [api_user]
[PWD] => [api_pwd]
[SIGNATURE] => [api_sig]
[VERSION] => 109.0
)
This returns ACK "Success" and the relevant code for the button and links...
When I navigate to the link the Paypal page https://securepayments.sandbox.paypal.com/webapps/HostedSoleSolutionApp/webflow/sparta/hostedSoleSolutionProcess?hosted_button_id=HSSS-BPdXvwvPaocw3NpZuxuIhGZuRL1DXlbqFgOo1BvzVYWKoSNjWyYwVilsDmt-QRxxvPmrlA shows:
Error Processing Payment
Error Message "This transaction can't be processed. Please pay with another card."
I emailed Paypal Merchant Services but have not had a response for some weeks now. Does anyone have any ideas?
I have upgraded the sandbox to pro.
I made a test using your parameters and generated a payment link, it worked for me(got redirected to templateC page and made a card payment). I used my own test pro account though. Are you seeing the error after you entered card info? If so you may create a fake credit card number on this page, step 4,
https://www.paypal-knowledge.com/infocenter/index?page=content&widgetview=true&id=FAQ1413&viewlocale=en_US&direct=en

Is it possible to change only AMT using UpdateRecurringPaymentsProfile PayPal?

This question has been posted elsewhere however I have not found a specific answer yet.
What I want to do is simply change the amount (AMT) of a PayPal recurring payments profile from say £55.00 to £60.00. The amount is all I want to change. I am using the below to do this:
$request_params = array
(
'USER' => $api_username,
'PWD' => $api_password,
'SIGNATURE' => $api_signature,
'VERSION' => $api_version,
'METHOD' => 'UpdateRecurringPaymentsProfile',
'PROFILEID' => 'I-R159ACHCUJHF',
'AMT' => '60.00',
'NOTE' => 'Re-adjust amount to £60'
);
OR
&USER=xxxxxxx&PWD=123456789&SIGNATURE=xyxyxyxyxyxyx&VERSION=85.0&METHOD=UpdateRecurringPaymentsProfile&PROFILEID=I-R159ACHCUJHF&AMT=11.00&NOTE=Re-adjust+amount+to+%C2%A360&TAXAMT=0.00
So I guess my question is can this be done using the fields above only or do you know if I am missing some other variables that are required possibly?
On another note, when I run this on the sandbox I get the following error:
Array
(
[TIMESTAMP] => 2014-11-28T10:11:36Z
[CORRELATIONID] => 9a5452736a159
[ACK] => Failure
[L_ERRORCODE0] => 10001
[L_SHORTMESSAGE0] => Internal Error
[L_LONGMESSAGE0] => Timeout processing request
)
Does anyone understand what this means and if it relates to the way I am requesting the change in amount (AMT) in the params above?
Many thanks in advance.
According to the example I'm cribbing from, you also need to pass CURRENCYCODE. The only example I could actually find was on PayPal Developer Brazil:
https://www.paypal-brasil.com.br/desenvolvedores/code-sample/recurring-payments-php/

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!