expected an order id to be passed javascript
DarkSteven420
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Mar-29-2022
09:39 AM
Hello,
I can't figure out why when I try to buy with paypal it gives me this error into the console :
Spoiler
Error: Expected an order id to be passed
at https://www.sandbox.paypal.com/smart/buttons?style.label=paypal&style.layout=vertical&style.color=go...
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);
1 REPLY 1
DarkSteven420
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar-31-2022
07:18 AM
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Issue with 403 Forbidden Error when Accessing PayPal Sandbox API. in Sandbox Environment
- API - Change currency when shipping country changes in SDKs
- Can't Save PayPal for purchase later with the Javascript SDK, unable to pass setup token in SDKs
- IPN testing in sandbox in Sandbox Environment
- Uncaught Error: Expected an order id to be passed in SDKs