Not able to place the order using paypal in magento 2 rest

前端 未结 3 1162
臣服心动
臣服心动 2020-12-21 01:22

I am developing an e-commerce mobiloe application using magento 2 rest apis only.This is the flow for making the REST API calls for order placement.

3条回答
  •  鱼传尺愫
    2020-12-21 01:40

    If you use the below to run a post query replace runPostQuery with your curl request. this will pass a token that already has been successful to magento 2.

     $payment['paymentMethod'] = ['method' =>'paypal_express',
                   'additional_data' => array (
                       'paypal_express_checkout_token' => $request->query->get('token'),
                       'paypal_express_checkout_redirect_required' => false,
                       'paypal_express_checkout_payer_id' => $request->query->get('PayerID')
                   )];
    
    
               $completedPayment = $this->runPostQuery('carts/mine/payment-information', $headers, json_encode($payment));
    

    You will need to create a plugin to add the last transaction id to the payment see the above comment, but the above payload to payment-information will allow you to get past _placeOrder function in Paypal\Model\Express.php

    The paypal_express_checkout_token is the token passed back to the browser from paypal same as PayerId this allows to check the payment, which will return successful and not require a redirect, but is not the payment reference just the action token.

提交回复
热议问题