1

I try to integrate Paypal Plus. Everything works fine now (well, almost everything :) )

  1. Create Payment
  2. Render the Paypal Plus Iframe
  3. Click an external Button to redirect the User to the Paypal hosted Pages
  4. Display the Review-Page
  5. Execute Payment und display the Thank You-Page

Following the Paypal-Plus-Integration Guide, i should not provide any personal Data in the Create-Payment-Call. For this i should do an Update-Payment-Call.

But how do I know, that the User has clicked an Paypal-Payment-Option within the Paypal-Iframe? If i configure some third-party-payments, i can define a callback. But there is no callback, if the user selects a paypal-payment-method. So, after the user has clicked on the external continue-Button, the user is directly redirected to the paypal-hosted pages, and i got no chance to proceed the Update-Call ("Patch"-Request, to add the Billing-Adress to the paypal payment session, for e.g.).

Can somebody help me?

I read the manual a lot of times and googled, viewed some yt-videos .. but, it seems, that i did not understand the flow.. ;-)

What is your exact flow, if you use Paypal-Plus and their Iframe Payment-Wall...?

Obsidian
  • 3,719
  • 8
  • 17
  • 30
MikeE
  • 11
  • 2
  • If the user has done this from the PayPal iframe, why do you need to know which button they pressed? Doesn't the info go straight to the PayPal servers and therefore not require any action from you on the user's behalf? – Anthony Jun 24 '19 at 23:15
  • Let me ask another way: what is it the user is doing that requires you to know from that point (where they are already looking at the PayPal iframe and clicking buttons inside that iframe) what they clicked on and trigger a patch request? – Anthony Jun 24 '19 at 23:18

1 Answers1

0

I struggled also with this problem and I solved it now with a curl patch request after the initial request. I have actual no Idea if this is a problem with thirdparty-payment-methods. I will take a look in the future if this will work in the same way. Actually I'm satisfied that paypal plus is working with the payer_info.

$ch = curl_init($paypalUrl.'/v1/payments/payment/'.$paymentID);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Bearer '.$json->access_token
));

$data =
'[{
    "op": "add",
    "path": "/payer/payer_info",
    "value": {
        "first_name": "Max",
        "last_name": "Mustermann",
        "email": "max@mustermann.com",
        "billing_address": {
            "line1": "Lieferstr. 1",
            "city": "Berlin",
            "country_code": "DE",
            "postal_code": "12345"
        }
    }
}]';

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

$result = curl_exec($ch);
$jsonResult = json_decode($result);

curl_close($ch);

The other idea would be to use a own in between site like here on page 23 mentioned with the nextpage.phpon window.location for the continue button. And call here the patch request. Hopeful it can help someone!

Cheers

JFS
  • 57
  • 1
  • 13