PaypalPLus CreatePayment // No BasketData Transmitted
marexxx
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Sep-12-2018
11:41 PM
Hi,
i'm new to Paypal implementation. So please be patient 🙂
I'm trying to integrate Paypal Plus into a TYPO3 Shop. With a Simple Paypal Button it does work fine.
For Paypal Plus i create a payment like this:
/*------------------- Paypal START ---------------------*/ if($('#ppplus').length > 0) { $.get("/fileadmin/shop/paypal.php", { 'total': paypal_total, 'subtotal': paypal_subtotal, 'tax': paypal_tax, 'shipping': paypal_shipping, 'description': paypal_description, 'invoice_number': 'teetss', 'recipient_name': paypal_recipient_name, 'items':itemlist }, function (data, status) { var parsed = $.parseJSON(data); approvalUrl = parsed.links[1].href; var ppp = PAYPAL.apps.PPP({ "approvalUrl": approvalUrl, "placeholder": "ppplus", "mode": "sandbox", "country": "DE", "language": "DE_de" }); }); } /*--- Paypal END */
The Result looks like this:
{id: "PAY-XXX", intent: "sale", state: "created",…} create_time: "2018-09-13T06:34:28Z" id: "PAY-XXX" intent: "sale" links: [,…] 0: {href: "https://api.sandbox.paypal.com/v1/payments/payment/PAY-XXX", rel: "self",…} 1: {,…} href: "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-XXX" method: "REDIRECT" rel: "approval_url" 2: {href: "https://api.sandbox.paypal.com/v1/payments/payment/PAY-XXX/execute",…} payer: {payment_method: "paypal"} payment_method: "paypal" state: "created" transactions: [{,…}] 0: {,…} amount: {total: "34.50", currency: "EUR", details: {subtotal: "24.49", tax: "5.51", shipping: "4.50"}} currency: "EUR" details: {subtotal: "24.49", tax: "5.51", shipping: "4.50"} shipping: "4.50" subtotal: "24.49" tax: "5.51" total: "34.50" description: "Parkett Herter Shop" invoice_number: "teetss" item_list: {} related_resources: []
paypal.php
<?php $total = htmlspecialchars($_GET["total"]); $subtotal = htmlspecialchars($_GET["subtotal"]); $tax = htmlspecialchars($_GET["tax"]); $shipping = htmlspecialchars($_GET["shipping"]); $description = htmlspecialchars($_GET["description"]); $invoice_number = htmlspecialchars($_GET["invoice_number"]); $recipient_name = htmlspecialchars($_GET["recipient_name"]); $items = htmlspecialchars($_GET["items"]); $ch = curl_init(); $data = '{ "intent": "sale", "payer": { "payment_method": "paypal" }, "transactions": [ { "amount": { "total": "'.$total.'", "currency": "EUR", "details": { "subtotal": "'.$subtotal.'", "tax": "'.$tax.'", "shipping": "'.$shipping.'" } }, "description": "'.$description.'", "invoice_number": "'.$invoice_number.'", "item_list": {'.$items.'} } ], "redirect_urls": { "return_url": "xxx", "cancel_url": "xxx" } }'; curl_setopt($ch, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/payments/payment"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json", "Authorization: Bearer xxx", "Content-length: ".strlen($data)) ); $output = curl_exec($ch); curl_close($ch); //print_r($output); ?>
So the "Paypal Wall" Iframe is created and I can choose a Payment Option. But when I'm redirected to Paypal there are no Informations about the Customer, the Price... What Am I missing?
0 REPLIES 0
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.