Express Checkout, Transaction Details, Shopping Cart not showing options - paypal

The product info is passed with SetExpressCheckout and all appears on the payment page, all the same info is sent with the DoExpressCheckoutPayment and the transaction is successful.
When reveiwing the transaction in the seller sandbox account the info sent using L_PAYMENTREQUEST_n_DESCm does not appear in the 'options' section of the shopping cart contents, the information from all the other parameters however (L_PAYMENTREQUEST_n_NAMEm, L_PAYMENTREQUEST_n_NUMBERm, L_PAYMENTREQUEST_n_AMTm, L_PAYMENTREQUEST_n_QTYm) is shown. I have also tried using L_DESCm but with the same result.
I have tried a very basic example based on this guide.
Using 3 HTML Forms I completed a transaction that replicates the problem outlined.
<form method=post action=https://api-3t.sandbox.paypal.com/nvp>
<input type=hidden name=USER value=yourusr>
<input type=hidden name=PWD value=yourpwd>
<input type=hidden name=SIGNATURE value=yoursig>
<input type=hidden name=VERSION value=93>
<input type=hidden name=PAYMENTREQUEST_0_PAYMENTACTION value=Sale>
<input type=hidden name=L_PAYMENTREQUEST_0_NAME0 value="Decaf Coffee Blend">
<input type=hidden name=L_PAYMENTREQUEST_0_NUMBER0 value=623083>
<input type=hidden name=L_PAYMENTREQUEST_0_DESC0 value="8oz vacuum pack">
<input type=hidden name=L_PAYMENTREQUEST_0_AMT0 value=19.95>
<input type=hidden name=L_PAYMENTREQUEST_0_QTY0 value=1>
<input type=hidden name=PAYMENTREQUEST_0_AMT value=19.95>
<input type=hidden name=PAYMENTREQUEST_0_CURRENCYCODE value=GBP>
<input type=hidden name=RETURNURL value=http://www.yourdomain.co.uk/return.html>
<input type=hidden name=CANCELURL value=http://www.yourdomain.co.uk/home.html>
<input type=submit name=METHOD value=SetExpressCheckout>
</form>
<form method=post action=https://api-3t.sandbox.paypal.com/nvp>
<input type=hidden name=USER value=yourusr>
<input type=hidden name=PWD value=yourpwd>
<input type=hidden name=SIGNATURE value=yoursig>
<input type=hidden name=VERSION value=93.0>
<input name=TOKEN value=overtype with your token>
<input type=submit name=METHOD value=GetExpressCheckoutDetails>
</form>
<form method=post action=https://api-3t.sandbox.paypal.com/nvp>
<input type=hidden name=USER value=yourusr>
<input type=hidden name=PWD value=yourpwd>
<input type=hidden name=SIGNATURE value=yoursig>
<input type=hidden name=VERSION value=93>
<input type=hidden name=PAYMENTREQUEST_0_PAYMENTACTION value=Sale>
<input name=PAYERID value=overtype with your payerid>
<input name=TOKEN value=overtype with your token>
<input type=hidden name=L_PAYMENTREQUEST_0_NAME0 value="Decaf Coffee Blend">
<input type=hidden name=L_PAYMENTREQUEST_0_NUMBER0 value=623083>
<input type=hidden name=L_PAYMENTREQUEST_0_DESC0 value="8oz vacuum pack">
<input type=hidden name=L_PAYMENTREQUEST_0_AMT0 value=19.95>
<input type=hidden name=L_PAYMENTREQUEST_0_QTY0 value=1>
<input type=hidden name=PAYMENTREQUEST_0_AMT value=19.95>
<input type=hidden name=PAYMENTREQUEST_0_CURRENCYCODE value=GBP>
<input type=submit name=METHOD value=DoExpressCheckoutPayment>
</form>

The DESC parameter is essentially ignored with Express Checkout. It's annoyed me for years that they include it but don't seem to use it.
If you want to provide details about item(s) in your PayPal payment you'll need to include actual cart item details in the request.
Take a look at my Express Checkout demo for my PHP class library for PayPal, which by the way, would make API calls to PayPal a lot quicker and easier on you than what you're doing.
Anyway, the demo includes a basic Express Checkout as well as one with line items. You should take a look at the one with line items so you can reproduce what it's doing.
You can also just look at the API documentation specific to cart items in Express Checkout. Just like you mentioned, you'll need to make sure to include all those details in both SEC and DECP in order for them to show up in the final payment details.
On that note, DECP does include a USESESSIONPAYMENTDETAILS parameter which you can set to true. When this is done, it will go ahead and use the details that were included in SEC so you don't have to include them again in DECP.
Hope that helps!

Related

PayPal web error: We're sorry, but we couldn't complete your purchase using the funding source you selected

I created an account in PayPal and integrated with PHP in live mode. But when I enter my card details and submit then error message found.
We're sorry, but we couldn't complete your purchase using the funding source you selected. Please add a debit or credit card.
<form action="<?php echo $paypalUrl; ?>" method="post" name="frmPayPal1">
<div class="panel price panel-red">
<input type="hidden" name="business" value="<?php echo $paypalId; ?>">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="It Solution Stuff">
<input type="hidden" name="item_number" value="2">
<input type="hidden" name="amount" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="currency_code" value="AUD">
<input type="hidden" name="cancel_return" value="http://localhost/paypal/cancel.php">
<input type="hidden" name="return" value="http://localhost/paypal/success.php">
<div class="panel-heading text-center">
<h3>PRO PLAN</h3>
</div>
<div class="panel-body text-center">
<p class="lead" style="font-size:40px"><strong>$20 / month</strong></p>
</div>
<ul class="list-group list-group-flush text-center">
<li class="list-group-item"><i class="icon-ok text-danger"></i> Personal use</li>
<li class="list-group-item"><i class="icon-ok text-danger"></i> Unlimited projects</li>
<li class="list-group-item"><i class="icon-ok text-danger"></i> 27/7 support</li>
</ul>
<div class="panel-footer">
<button class="btn btn-lg btn-block btn-danger" href="#">BUY NOW!</button>
</div>
</div>
</form>
Some variables used in redirection are:
<?php
$paypalUrl='https://www.paypal.com/cgi-bin/webscr';
$paypalId='xxx#xxxxxxxx.xxx';
?>
This isn't an issue for Stackoverflow. There is no technical problem, and certainly no programming problem.
The issue is in the title: "We couldn't complete your purchase using the funding source you selected.", and the solution follows in the quoted message: "Please add a debit or credit card."
This is a normal business exception. When a user sees this message, they need to pay with a different payment method, such as a different card.

Item description not showing up on details

I have a cart form that submits to paypal with the item_name and item_number. As of recently though, some of the paypal receipts (transaction details) I have been receiving are excluding the "item_number" in the description. I need this number to know what products the user has purchased.
The only common factor with the receipts that do not include the "item_number" are ones that have a "Receipt No:" with the text "Please keep this number for future reference, as your customer doesn't have a PayPal Transaction ID for this payment."
Any idea why this is happening, or what I need to do to get the "item_number" to show up on the receipt?
Code Example:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<label for="first_name">First Name*:</label>
<input type="text" name="first_name" id="first_name" class="required">
<label for="last_name">Last Name*:</label>
<input type="text" name="last_name" id="last_name" class="required">
<label for="email">Email*:</label>
<input type="text" name="email" id="email" class="required email">
<input type="hidden" name="item_name" value="Personalized Frame">
<input type="hidden" name="item_number" value="|S5|M8|T8|black">
<input type="submit" value="Add to Cart">
</form>

Not able to specify "amount" per payment request on PayPal HTMLButton

I am trying to integrate with PayPal using the "HTML Buttons" approach.
The checkout flow is rather simple,
user clicks "Buy Now" -> transferred to PayPal -> payment processed -> returned to the site.
Based on the item that the customer wants to "Buy Now", the "amount" in the submitted form will vary, and I am unable to get PayPal to accept the value I am sending. I always see a text input which is empty when redirected to PayPal.
I tried hosted and unhosted buttons but still not able to see the desired effect.
hosted button HTML example:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="HOSTEDBTNVALUE">
<input type="image" src="https://www.sandbox.paypal.com/en_GB/SG/i/btn/btn_buynowCC_LG.gif" name="submit" alt="PayPal – The safer, easier way to pay online!" style="border: 0;">
<img alt="" src="https://www.sandbox.paypal.com/en_GB/i/scr/pixel.gif" style="border: 0; width: 1; height: 1;">
<input type="text" readonly="true" name="item_name" value="Test PayPal integration payment">
<div class="form-group" id="amount_field">
<label class="control-label col-md-2" for="amount">Amount</label>
<div class="col-md-5">
<input type="text" id="amount" name="amount" value="100" aria-describedby="amount_info_0" class="form-control"><span id="amount_info_0" class="help-block">Real</span></div>
</div>
<div class="form-group" id="txnRef_field">
<label class="control-label col-md-2" for="txnRef">Transaction Ref</label>
<div class="col-md-5">
<input type="text" id="txnRef" name="txnRef" value="8d724ad470af4d9d91d49f84068c4bab" aria-describedby="txnRef_info_0" class="form-control"><span id="txnRef_info_0" class="help-block">Required</span></div>
</div>
<input type="hidden" name="currency_code" value="SGD">
</form>
The "amount" above is a text input at the moment because this is my integration testing page, in the actual application it will be a hidden/readonly input embedded in the form.
Here is the unhosted button example code:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----ReallyLongKey-----END PKCS7-----">
<input type="image" src="https://www.sandbox.paypal.com/en_GB/SG/i/btn/btn_buynowCC_LG.gif" name="submit" alt="PayPal – The safer, easier way to pay online!" style="border: 0;"><img alt="" src="https://www.sandbox.paypal.com/en_GB/i/scr/pixel.gif" style="border: 0; width: 1; height: 1;">
<input type="hidden" name="notify_url" value="https://myapplication.com/transaction/paypal/status">
<input type="hidden" name="currency_code" value="SGD">
<input type="hidden" name="custom" value="ad4a63e2f2f04b908ddb8e7c67f9c67a">
<input type="text" readonly="true" name="item_name" value="Test PayPal integration payment">
<div class="form-group" id="amount_field">
<label class="control-label col-md-2" for="amount">Amount</label>
<div class="col-md-5">
<input type="text" id="amount" name="amount" value="100" aria-describedby="amount_info_0" class="form-control"><span id="amount_info_0" class="help-block">Real</span></div>
</div>
<div class="form-group" id="txnRef_field">
<label class="control-label col-md-2" for="txnRef">Transaction Ref</label>
<div class="col-md-5">
<input type="text" id="txnRef" name="txnRef" value="ad4a63e2f2f04b908ddb8e7c67f9c67a" aria-describedby="txnRef_info_0" class="form-control"><span id="txnRef_info_0" class="help-block">Required</span></div>
</div>
</form>
I have screenshots below for the application page and what I see as a result on the PayPal payment page. Please excuse the lack of alignment and styling. This is meant to be a proof of concept before it is pretty.
my application test page for integration
paypal page where amount is expected to be fixed based on my request and not editable.
Not sure what I'm doing wrong here. Please help.
thanks.
I was able to get it going by making PayPal generate the button with the following settings:
1. Merchant account IDs: Use my primary email address [did not use secure merchant account ID]
2. unchecking the save button at PayPal checkbox. Also, in the html button generation interface, I clicked the link remove code protection which made the cmd value from _s-xclick to _xclick

Pay pal cart options being set to only one and not a drop down with multiples.

How do I create an add to cart option on Paypal without a drop down box. I have single unique items only so don't want to offer a choice of more than one. How do i do this? Any help appreciated
Simply use this snippet and make your customizations on the tag values:
<form method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" value="_cart" name="cmd">
<input type="hidden" value="1" name="add">
<input type="hidden" value="usm#email.com" name="business">
<input type="hidden" value="USD" name="currency_code">
<input type="hidden" value="http://yourReturnURL/" name="return">
<input type="hidden" value="Carrot Soup" name="item_name">
<input type="hidden" value="12" name="amount">
<input type="image" name="submit" src="http://www.paypal.com/en_US/i/btn/btn_cart_LG.gif">
</form>

Paypal throws empty response while send multiple items

I am working from last couple of days on same issue. Getting empty response while sending multiple items. But, for single payment, I am getting Array values. Can you please check the below code and let me know any changes required.
Test.php
..............
<?php
$cur_dir='http://'.$_SERVER['SERVER_NAME'] . dirname($_SERVER['REQUEST_URI']);?>
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<INPUT TYPE="hidden" name="charset" value="utf-8">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="xxxxxxx#gmail.com">
<input type="hidden" name="currency_code" value="US">
<input type="hidden" name="item_name_1" value="beach ball">
<input type="hidden" name="amount_1" value="15">
<input type="hidden" name="item_name_2" value="towel">
<input type="hidden" name="amount_2" value="20">
<input type="hidden" name="return" value="<?php echo $cur_dir.'/test1.php'; ?>">
<input type="hidden" name="notify_url" value="<?php echo $cur_dir.'/test.php'; ?>">
<input type="image" value="submit" src="images/byunow.jpg" alt="submit Button" >
</fieldset>
</form>
Test1.php returns Empty value
.................
<?php print_r($_POST); ?>
You may want to enable the Payment Data Transfer feature for the seller account - see: https://developer.paypal.com/webapps/developer/docs/classic/products/payment-data-transfer/
you can then take the returned data to establish a secure connection to paypal in order to retrieve payment details.
However, please bear in mind that the buyer won't hit the return URL 100% of the time - so you will want to rely on IPN (See: https://developer.paypal.com/webapps/developer/docs/classic/ipn/gs_IPN/) for processes like updating an order status.
IPNs are sent to the "notify_URL" as soon as a new transaction arrives on the account.