expected an order id to be passed javascript

DarkSteven420
Contributor
Contributor

Hello,

I can't figure out why when I try to buy with paypal it gives me this error into the console :

Spoiler

if you wanna have a look at my code :

Spoiler
                       orderid = makeid(12);
                       const paymentData = {
                           intent: "CAPTURE",
                           flow: 'checkout',
                           env: "test",
                           application_context: {
                               brand_name: "Skunker",
                               locale: "fr-FR",
                               landing_page: "BILLING",
                               shipping_preference: "SET_PROVIDED_ADDRESS",
                           },
                           orderid: orderid,
                           purchase_units: [{
                               reference_id: orderid,
                               custom_id: orderid,
                               description: email,
                               invoice_id: orderid,
                               payer: {
                                   email_address: email,
                               },
                               amount: {
                                   currency_code: "EUR",
                                   value: shoppingCart.totalCart() + 6.15,
                                   breakdown: {
                                       item_total: {
                                           currency_code: "EUR",
                                           value: shoppingCart.totalCart()
                                       },
                                       tax_total: {
                                           currency_code: "EUR",
                                           value: 0.20
                                       },
                                       shipping: {
                                           currency_code: "EUR",
                                           value: 5.95
                                       },
                                       handling: {
                                           currency_code: "EUR",
                                           value: 0.00
                                       },
                                       insurance: {
                                           currency_code: "EUR",
                                           value: 0.0
                                       },
                                       shipping_discount: {
                                           currency_code: "EUR",
                                           value: 0.00
                                       }
                                   }
                               },
                               items: Cart5,
                               shipping: {
                                   method: "La Poste - Colissimo",
                                   address: {
                                       name: {
                                           given_name: surname[0],
                                           surname: surname[1],
                                       },
                                       address_line_1: response.address,
                                       admin_area_2: response.city,
                                       postal_code: response.postalCode,
                                       country_code: "FR"
                                   },
                                   phone_number: {
                                       country_code: '33',
                                       national_number: response.tel,
                                   }
                               }
                           }]
                       }

                       return actions.order.create(paymentData);

 

Login to Me Too
1 REPLY 1

DarkSteven420
Contributor
Contributor

anyone?

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.