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.

1
  • Have you found out yet?
    – awavi
    Commented Dec 21, 2016 at 3:17

3 Answers 3

2

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!

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"
    }
}
1
  • 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
    Commented Jun 22, 2017 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.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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