Paypal-checkout-components: Expected an order id to be passed

Created on 6 May 2020  路  3Comments  路  Source: paypal/paypal-checkout-components

Description

onCreate response is 200:

{id: "8GN37432852384745",鈥
id: "8GN37432852384745"
links: [{href: "https://api.sandbox.paypal.com/v2/checkout/orders/8GN37432852384745", rel: "self",鈥,鈥
status: "CREATED"

but Paypal tab closes and browser console shows:

Uncaught Error: Expected an order id to be passed

Version: 5.0.124

My code:

<script src="https://www.paypal.com/sdk/js?client-id=MY_ID&currency=USD&intent=capture"></script>
          .Buttons({
            createOrder: (data, actions) => this.handlePaypalOrderCreation(data, actions, 100),
            onApprove: (data, actions) => this.handlePaypalApprovedTransaction(data, actions),
          })
          .render('#paypal-button-container')



md5-4a53a3d7ebf2c4d5fd10c17aec94a0da



handlePaypalOrderCreation: function(data, actions, amount) {
      try {
        actions.order.create({
          purchase_units: [
            {
              amount: {
                currency_code: 'USD',
                value: amount,
              },
            },
          ],
        })
      } catch (error) {
        console.log(error) // Does not log anything
      }
    },

This error is thrown in this file: https://github.com/paypal/paypal-smart-payment-buttons/blob/265da2f9526fd20734bef29a681cda4b26e5a0ea/src/props/createOrder.js

Affected browsers

  • [*] Chrome
outdated

Most helpful comment

You need to return actions.order.create({

All 3 comments

You need to return actions.order.create({

Thank you.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stephen-last picture stephen-last  路  6Comments

domtripodi picture domtripodi  路  5Comments

deejbee picture deejbee  路  5Comments

Warix3 picture Warix3  路  4Comments

mtshare picture mtshare  路  5Comments