cocoastorm / vue-paypal-checkout

A simple Vue.js wrapper component for paypal-checkout
MIT License
153 stars 67 forks source link

[400] INVALID CURRENCY_AMOUNT_FORMAT when pressing the paypal checkout button #97

Closed abrhambas01 closed 4 years ago

abrhambas01 commented 4 years ago

Please Help [ I tried to follow all the instructions in the readme that you provided..

Here is the code

<paypal-checkout
                style="height:5em; width:100%; padding:20px;"
                v-show="form.payment_option == 1"
                amount="form.offer_bounty"
                currency="USD"
                :env="environment"
                :style="button_style"
                :client="paypal">
            </paypal-checkout>

and this is in my data object

data(){
        return {
            form: { 
                offer_bounty : 10,
                currencyCode : 4,
                payment_option : 1,
            },
            my_items : [
            {
                "name": "hat",
                "description": "Brown hat.",
                "quantity": "1",
                "price": "5",
                "currency": "USD"
            },
            {
                "name": "handbag",
                "description": "Black handbag.",
                "quantity": "1",
                "price": "5",
                "currency": "USD"
            }
            ],

            paypal: {
                sandbox: 'ASKgsenjMcu30HAZQM_IRrlaEXjEkD5iJQaCO095cO8cL714mr6aIcIJO-TZ9xDgd-50ViBkfryO1-Jw',
                production: 'ARVBy7D7n5t2sHfx56TXtszDOKWlsl9Rhww9tW7AFGCh--mJdOWr7-VFP1Qy9SSSNhqo7j5i4uWvHnZm'
            },
            environment : "sandbox",
            button_style : {
                label: 'checkout',
            size:  'large',    // small | medium | large | responsive
            shape: 'pill',         // pill | rect
            color: 'blue'         // gold | blue | silver | black
        },

    }
}

it all gives me successful message but when I press on the

image

but this time it's 400 error. Specifically something that says

Uncaught Error: Request to post https://www.sandbox.paypal.com/v1/payments/payment failed with 400 error. Correlation id: 8831010276d3e, 8831010276d3e

{
    "name": "VALIDATION_ERROR",
    "message": "Invalid request - see details",
    "debug_id": "8831010276d3e",
    "information_link": "https://developer.paypal.com/docs/api/payments/#errors",
    "details": [
        {
            "field": "transactions.amount",
            "location": "body",
            "issue": "Cannot construct instance of `com.paypal.platform.payments.model.rest.common.Amount`, problem: INVALID_CURRENCY_AMOUNT_FORMAT line: 1, column: 74"
        }
    ]
}

    at XMLHttpRequest.xhrLoad (http.js:114)
    at Object._RECEIVE_MESSAGE_TYPE.<computed> [as postrobot_message_response] (app.js:86593)
    at receiveMessage (app.js:86698)
    at messageListener (app.js:86722)
    at Object._RECEIVE_MESSAGE_TYPE.<computed> [as postrobot_message_response] (types.js:121)
    at receiveMessage (index.js:114)
    at messageListener (index.js:140)