0

I'm attempting to integrate PayPal in a headless Magento environment. This headless environment is interacting with Magento over the Magento REST API. I have another payment system (Authorize.net) that is working. However, I'm getting errors with PayPal.

I'm using the PayPal JavaScript SDK and I'm able to make PayPal transactions directly through JavaScript.

enter image description here

I'm attempting to pass the PayPal confirmation API response back to Magento 2 via the REST API.

POST /rest/default/V1/guest-carts/(customer-quote-id)/payment-information

Body:

{
  "email": "xxxxx@xxxxx.xxxx",
  "paymentMethod": {
    "method": "paypal_express",
    "additional_data": {
        "paypal_express_checkout_token" : "xxxxxxxxxxxxxx",
        "paypal_express_checkout_redirect_required" : false,
        "paypal_express_checkout_payer_id" : "xxxxxxxxxx"
    }
  },
  "billingAddress": {
    "region": "Indiana",
    "region_id": 24,
    "country_id": "US",
    "street": [
      "123"
    ],
    "telephone": "xxxxxxxxxxx",
    "postcode": "xxxxxx",
    "city": "xxxxxxxx",
    "firstname": "xxxxxxxx",
    "lastname": "xxxxxxxx",
    "save_in_address_book": null
  }
}

When I submit the payment, I get the error:

{
    "message": "PayPal gateway has rejected request. Security header is not valid (#10002: Security error)."
}

I have ENABLED Sandbox Mode and DISABLED Enable SSL Verification and I'm getting the same error as above.

Your Answer

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

Browse other questions tagged or ask your own question.