cocoastorm / vue-paypal-checkout

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

flow_config.user_action cannot be set to "Continue" #44

Open Connum opened 6 years ago

Connum commented 6 years ago

Hi there,

this might not be the component's fault, but as the docs state that a "valid object with the Experience options" can be passed, I'm posting this here in the hope that someone has an idea.

This is what my experienceOptions look like:

      experienceOptions: {
        presentation: {
            ...
        },
        flow_config: {
          landing_page_type: 'Billing',
          user_action: 'Continue'
        },
        input_fields: {
          no_shipping: 1,
          address_override: 1
        }
      }

However, as soon as I set the user_action to 'Continue' (also tried small-caps 'continue'), I get an error from the API:

{
    "name": "VALIDATION_ERROR",
    "debug_id": "9a81813a1c23",
    "message": "Invalid request - see details",
    "information_link": "https://developer.paypal.com/docs/api/payment-experience/#errors",
    "details": [
        {
            "field": "flow_config.user_action",
            "issue": "Value is invalid (must be commit)"
        }
    ]
}

Any idea why I shouldn't be able to set the user_action to anything other than 'commit'? Maybe a combination with another (default) setting that prevents it? I don't want to use the "Pay now" approach, because I fear that a tech-savvy user could tamper with the cart amount, so I want to get the Payment ID and check that server-side before making the actual purchase. And as the component doesn't support Advanced Integration yet (see #36), I think there's no other option.

Any help appreciated.

cocoastorm commented 6 years ago

Hey @Connum,

The paypal-checkout button exposes a prop called commit which should be what you're looking for. It's normally true by default. I'm guessing you can set commit: false instead?

If this doesn't work for you let me know! I'll look into it.

Cheers!

Connum commented 6 years ago

Thanks for the quick response! Currently I can't access the REST API at all (always receiving a status of 401), but I'll try it out and let you know, as soon as it's working again.

cocoastorm commented 6 years ago

Hey @Connum,

Did you get it to work?

Connum commented 6 years ago

Unfortunately, I still haven't been able to test it due to the API error. Even tried a new key, but to no avail. But I hope this will be sorted out soon!

Connum commented 6 years ago

Hi @khoanguyen96, thanks, it works!

Connum commented 6 years ago

One thing that I still don't understand though is that the payment is automatically being completed after authorization, without the user having to confirm it on the page again. This seems to be triggered by the component? Shouldn't there be a check in "onAuthorize" for the commit prop?

cocoastorm commented 6 years ago

Hey @Connum,

I never used it without commit: true before, so you're most likely right. I'll add a check for the commit prop beforehand.

Cheers!

P.S. Thanks for the PR I'll take a look at it as soon as I can. 👍

bhaskararao-nyros commented 6 years ago
<PayPal
       env="sandbox"
       amount="0.01"
       currency="USD"
       locale="en_US"
       :client="paypal_credentials"
       :paypal-paymentAuthorized="onPaymentSuccess"
       :paypal-paymentCancelled="onPaymentFail">
</PayPal>

I imported and used this code and provided sandbox client ID.But not working.can you please help me how to get responses while doing payment

cocoastorm commented 6 years ago

hey @bhaskararao-nyros,

The event names were changed recently.

https://github.com/khoanguyen96/vue-paypal-checkout#events-fired-by-the-simple-paypal-component

What version of vue-paypal-checkout do you have installed?