4

I am using REST API to create orders. I would like to know which is the right API call and payload if paypal express checkout is the payment method to process payment and generate invoice.

  • Have you found out yet? – awavi Dec 21 '16 at 3:17
1

We also had the same issue when we tried the below payload it worked

Endpoint: http://localhost:8888/Magento/index.php/rest/V1/carts/mine/payment-information

{ "paymentMethod": { "method": "paypal_express", "additional_data": { "paypal_express_checkout_token" : "EC-xxxxxxxxxxxx", "paypal_express_checkout_redirect_required" : false, "paypal_express_checkout_payer_id" : "XXXXXXXXXX" } } }

In order to get the payment token we used the paypal set express checkout api directly

Here is more details

https://developer.paypal.com/docs/classic/express-checkout/ht_ec-singleItemPayment-curl-etc/?mark=Do%20Express%20Checkout%20Call#

When the customer approves the payment we will get the payer id in the returned url.

Hope this helps!

| improve this answer | |
0

You can use the native API of the Paypal using this documentation, so you can place an order using the Magento API.

Place Order

curl -g -X PUT "XXXXX_STOREURL_XXXXX/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/order" \
    -H "Authorization: Bearer XXXXX_TOKEN_XXXXX" \
    -H "Content-Type:application/json" \
     -d '
{
    "method": {
        "method": "checkmo"
    }
}
| improve this answer | |
  • 1
    The method in this solution is "checkmo", not "paypal_express" as the question asks for. If this is intended, how do you integrate PayPal (ie. fetching tokens, updating the transaction on the order)? – Wireblue Jun 22 '17 at 5:27
0

In case someone still looking the solution, you need to call :

  • for logged user : PUT /V1/carts/mine/order
  • for guest : PUT /V1/guest-carts/:cartId/order

Referrence : http://devdocs.magento.com/swagger

You need to implement the Paypal payment in your app, in example for Android you need to use Paypal Android SDK, then send the payment ID to above endpoint.

The above endpoint in the time I'm answering this, will return error related with Paypal gateway token. You will need to create a Magento 2 module to process the payment ID. A custom payment gateway module or something else to make the order created, which having almost similar info to what order created using Paypal express in your Magento 2 website storefront.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.