dynamic custom value paypal button - paypal

is possible to send combination of encrypted and decrypted input in paypal button?
sample
<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="first_name" value="" id="ctm_first_name">
<input type="hidden" name="last_name" value="" id="ctm_last_name">
<input type="hidden" name="address1" value="" id="ctm_address_street">
<input type="hidden" name="address2" value="" id="ctm_address_street_two">
<input type="hidden" name="city" value="" id="ctm_address_city">
<input type="hidden" name="state" value="" id="ctm_address_state">
<input type="hidden" name="zip" value="" id="ctm_address_zip">
<input type="hidden" name="email" value="" id="ctm_payer_email">
<input type="hidden" name="custom" value="" id="ctm_val">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7
-----END PKCS7-----
">
i have a dynamic data that i im populating using javascript..im afraid if its encrypted i cant call the input name or id ..so my javascript population code wont work
so can i pass input decrypt t and encrypt at the same time?

No, you need to decide the button type: hosted/encrypted and then use one type of button only.
You can use plaintext button as well but hosted button works best.
Example of plain text
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/html_example_buy_now/

Related

www.paypal.com/jp/cgi-bin/webscr? item_name encoding

I am working on a site that is trying pass a japanese item name to paypal through
this form
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input name="cmd" value="_xclick" type="hidden">
<input name="item_name" value="フォトグラフィー基礎コース" type="hidden">
<input name="amount" value="59000" type="hidden">
<input name="currency_code" value="JPY" type="hidden">
<input type="hidden" name="item_number" value="PHP001">
<input name="no_note" value="0" type="hidden">
<input type="hidden" name="lc" value="ja_JP">
<input name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest" type="hidden">
<input class="coursepayment" name="submit" value="今すぐ購入" alt="PayPal - The safer, easier way to pay online!" border="0" type="submit">
</form>
But the Item name comes out reading:
フォトグラフィー基礎コース
Is there a way to fix this?
See the documentation for the form method:
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/formbasics/#setting-the-character-set--charset
Setting the Character Set — charset
Use the charset HTML variable to specify the character set and
character encoding for the billing information/log-in page on the
PayPal website. In addition, this variable sets the same values for
information that you send to PayPal in your HTML button code.
For example, the following INPUT tag sets the encoding to UTF-8:
<INPUT TYPE="hidden" name="charset" value="utf-8">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input name="cmd" value="_xclick" type="hidden">
<input type="hidden" name="charset" value="utf-8">
<input name="item_name" value="フォトグラフィー基礎コース" type="hidden">
<input name="amount" value="59000" type="hidden">
<input name="currency_code" value="JPY" type="hidden">
<input type="hidden" name="item_number" value="PHP001">
<input name="no_note" value="0" type="hidden">
<input type="hidden" name="lc" value="ja_JP">
<input name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest" type="hidden">
<input class="coursepayment" name="submit" value="今すぐ購入" alt="PayPal - The safer, easier way to pay online!" border="0" type="submit">
</form>
Another alternative is to set the default encoding accepted by the PayPal account (which as of today is still not utf-8 until you set it that way).
Check "More Options" under https://www.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-language-encoding

Paypal button failed to process some user payment

We integrated Paypal button to support our starting business. We received several user feedbacks about not being able to complete payment. They reported that they can see the payment page after clicking the Buy Now button. However they tried pay through Paypal account, pay with credit card and pay with Paypal credit. None of them work. However, no one in our team has faced such problem when checking out. So we really don't have an idea about what's going on. Here is an example Paypal button code we use:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="business#myticket.com">
<input type="hidden" name="env" value="www">
<input type="hidden" name="address_override" value="0">
<input type="hidden" name="item_name_1" value="演唱会">
<input type="hidden" name="amount_1" value="122">
<input type="hidden" name="discount_rate_1" value="10">
<input type="hidden" name="item_name_2" value="演唱会">
<input type="hidden" name="amount_2" value="122">
<input type="hidden" name="discount_rate_2" value="10">
<input type="hidden" name="shipping_1" value="$27.95">
<!-- Fill full name in the first_name field -->
<input type="hidden" name="first_name" value="Bruce Lee">
<input type="hidden" name="notify_url" value="https://www.myticket.com/payment/ipn">
<input type="hidden" name="address1" value="">
<input type="hidden" name="address2" value="">
<input type="hidden" name="city" value="">
<input type="hidden" name="state" value="">
<input type="hidden" name="zip" value="">
<input type="hidden" name="country" value="US">
<input type="hidden" name="email" value="">
<input type="hidden" name="custom" value="lmIvjDuZVRsCWFPDdfFsrKiNVrnAbWeTZSINiDuszZEGKjeXfhqxyqRrn">
<input type="hidden" name="paymentaction" value="authorization">
<input type="hidden" name="charset" value="utf-8">
<input type="hidden" name="return" value="https://www.myticket.com">
<input type="hidden" name="cancel_return" value="https://www.myticket.com">
<input type="image" name="submit" border="0" src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png" alt="Check out with PayPal">
</form>
Is there any problem with this Paypal button? If not, what else could be causing the payment to fail?
Besides, is there a way we can get a message about these failures? Right now we are using IPN. However IPN doesn't seem to notify us about these payment failures.
BTW, myticket.com is a fake url in this post.
Well first, when using Website Payments Standard buttons, you don't get much back as far as the declines. Typically you are only going to get details of declines back when you are using API calls to process the payment. As for the button itself, it looks fine to me. Perhaps some of the issue is with the special characters for the item name which is leading to the failure. You could try creating 2 of the same buttons/items but without the special characters and see if those same buyers run into the issue with the second button that they did with the first one. You could also try using the "lc" variable in your button code to see if this helps. You can see the description of what the "lc" variable does here.

Collecting user information

I need to collect information about our high school reunion attendees and allow them to pay via a PayPal button. I've created the PayPal Pay Now button, but not sure what if any information will be collected and sent back to me. Do I need a separate form to collect information or is there a way to make the PayPal button work as the submit button for the data I collect using a form?
You should use a IPN (Instant Payment Notification) for this. There are lots of good templates for this available on GitHub. Your form might look like this:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" >
<input type="hidden" name="business" value="YOUR PAYPAL ID">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="item_name" value="ITEM_NAME">
<input type="hidden" name="item_number" value="ITEM_NUMBER>
<input type="hidden" name="amount" value="TOTAL_AMOUNT">
<input type="hidden" name="custom" value="<?php echo $attendee_id ?>">
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cbt" value="Return to website">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="return" value="http://domain.com/success.php"/>
<input type="hidden" name="notify_url" value="http://domain.com/ipn.php"/>
<input type="hidden" name="cancel_return" value="http://domain.com/canceled.php"/>
<button type="submit">Pay using PayPal</button>
</form>

first_name last_name paypal ipn

I am trying to send POST vars to paypal ipn like that:
<form class="form-horizontal paypal-button" method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr" target="_top" style="opacity: 1;">
<input type="hidden" name="button" value="buynow">
<input type="hidden" name="business" value="vendedor#estadosbinarios.com">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="shipping" value="0">
<input type="hidden" name="tax" value="0">
<input type="hidden" name="notify_url" value="http://www.estadosbinarios.com/pagos/paypal_ipn.php">
<input type="hidden" name="return" value="http://www.estadosbinarios.com/pagos/success.php">
<input type="hidden" name="env" value="www.sandbox">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="bn" value="JavaScriptButton_buynow">
<!-- Enable override of buyers’s address stored with PayPal . -->
<input type="hidden" name="address_override" value="1">
<input id="nombre" name="first_name" type="text" placeholder="" class="form-control input-md">
<input id="nombre" name="last_name" type="text" placeholder="" class="form-control input-md">
</form>
But Paypal doesn´t care my vars first_name or last_name, paypal is always getting the vars from user account of paypal and overwriting that var.
Is there any way to choose my vars?
When people pay with PayPal through it is indeed going to use the info provided from the shipping address of their account. You can't get around this with Payments Standard like you're using.
You could switch to the Express Checkout API which would give you the option of collecting the buyers name, address, etc. and then passing that over to PayPal in a way that cannot be overridden. This way you'd get whatever they typed into your site instead of relying on PayPal to provide those details.

Passing Address details via the Buy Now button

I am trying to pass my users details to Paypal screen using the appropriate html variables but only some are getting passed!?!?!? This is driving me mad! The order details are fine.
My code is:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick" />
#*Order Details*#
<input type="hidden" name="business" value="sales#xxxxxx.co.uk">
<input type="hidden" name="item_name" value="Order Number 123">
<input type="hidden" name="amount" value="200.00">
<input type="hidden" name="currency_code" value="GBP">
#*Address Stuff *#
<input type="hidden" name="first_name" value="Barry">
<input type="hidden" name="last_name" value="White">
<input type="hidden" name="address1" value="1 Big Street">
<input type="hidden" name="address2" value="Big Mountain">
<input type="hidden" name="city" value="Big City">
<input type="hidden" name="country" value="GB">
<input type="hidden" name="email" value="Bob#bob.com">
<input type="hidden" name="lc" value="UK">
<input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_buynowCC_LG.gif"
border="0" name="submit" alt="PayPal — The safer, easier way to pay online." />
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1" />
</form>
The paypal screen shows some of the fields (name, email country!) but not all
Why are some of the fields populating and some not!!!!!!!!!
Thanks
It seems that if you don't supply all the address details then it will not display any!
If I add the zip field then it displays the address.
Paypal integration should be so simple but their documentation is so bad - shows what monopolies do for you.
all the address fields are optional according to the documentation ffs