An easier way to integrate PayPal express payment?

I created a module for creating and displaying products for Wordpress CMS, and now I'm trying to integrate some form of PayPal integration for the verification process.

I have a cart, products, delivery, results, everything that turned out at my end, and I was hoping that someone could point me in the easiest direction to send this information to PayPal. I understand that some ways to do this are not so safe, while others make you jump through hoops like some kind of show dog. I tried to learn how to use cURL, and then how to get it to work with PHP - it really seems like a mess. I now have cURL running on my WAMP server ... but ..

Is there a better way or should I continue to learn cURL?

I can format the data, but I need to send it to PayPal and do not mind doing it using JavaScript - this is not a paid wall, and every order is checked for accuracy by a person - so someone messing with the client side of the script does not bother me. I also definitely want to send them to PayPal, I do not want to store or process my credit card details. However, it would be nice to have IPN. Can someone point me in the right direction or assure me that I am already heading this path?

Thank you so much.

+5
source share
2 answers

This is how I automatically redirect PayPal with all the details of the form;

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="paypal">

 <input type="hidden" name="cmd" value="_xclick" />
  <input type="hidden" name="cbt" value="Return to example" />
 <input type="hidden" name="business" value="email" />
 <input type="hidden" name="item_name" value="example Purchase" />
 <input type="hidden" name="amount" value="9.99">
 <input type="hidden" name="button_subtype" value="services" />
 <input type="hidden" name="no_shipping" value="1">
 <input type="hidden" name="return" value="URL" />
 <input type="hidden" name="notify_url" value="URL"/>
 <input type="hidden" name="cancel_return" value="URL" />
<input type="hidden" name="currency_code" value="USD"/>
<input type="hidden" name="image_url" value="" />
<input type="hidden" id="custom" name="custom" value="invoice_id to track"/>
 <input type="hidden" class="btn btn-primary" style="width:100%" alt="PayPal - The safer, easier way to pay online!"/>

</form>

For multiple products, you can simply add more products to the form, for example:

<input type="hidden" name="item_name_1" value="Item #1">
<input type="hidden" name="amount_1" value="1.00">
<input type="hidden" name="item_name_2" value="Item #2">
<input type="hidden" name="amount_2" value="2.00">

However, the use of this method is not very large.

PHP , , IPN , .

<script type="text/javascript">
  function myfunc () {
     var frm = document.getElementById("paypal");
     frm.submit();
  }
  window.onload = myfunc;
</script>
+7

, PayPal SDK. , - IPN. https://www.x.com/developers/paypal/documentation-tools/paypal-sdk-index SDK -. , SDK 98 PHP.

Curl, SDK . - .

$setECResponse = $paypalService->SetExpressCheckout($setECReq);

. . . , , , ; .

, PayPal Express checkout, - . - PayPal . . , . "", API PayPal, PayPal, . PayPal . getTransactionDetails . .

API, . , .

$paypalService->SetExpressCheckout($setECReq);

URL- PayPal, . .

  $ PaypalService- > GetExpressCheckoutDetails ($ getExpressCheckoutReq);

$paypalService->GetExpressCheckoutDetails($getECReq);

$paypalService->DoExpressCheckoutPayment($DoECReq);

PayPal .

$paypalService->GetTransactionDetails($request);

. , , , .

IPN . IPN , . URL- - PayPal. SSL-.

SDK , PayPal , developer.paypal.com. . , .

+3

All Articles