Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Providing createBillingAgreement doesn't seem to stop providing createOrder under the hood #116

Open
2 tasks done
ctsimpouris opened this issue Oct 25, 2021 · 0 comments

Comments

@ctsimpouris
Copy link

To Do First

  • Did you try latest release?
    • Yeap, "react-paypal-button-v2": "^2.6.3",
  • Did you look for existing matching issues?
    • Yeap, nothing related found to createBillingAgreement "stuff"

Software Package Version:

Describe the bug
In theory, only one of the following should be provided to PayPal: createOrder, createBillingAgreement and createSubscription with an appropriate value of intent. Currently it seems that props are mixed before providing to PayPal script. With the appearence of the error, PayPal button is unresponsive.

To Reproduce

  • Providing createBillingAgreement and missing createOrder produces: Error: Do not pass both createBillingAgreement and createOrder
  • Made the same test as before with createOrder={false} or createOrder={undefined} or createOrder={null}. Error remains
  • Based on the code we have createOrder={(createSubscription || createBillingAgreement) ? undefined : createOrderFn} which translates to "if createBillingAgreement or createSubscription is provided do not provide createOrderFn to PayPal". So I tested providing createSubscription with no createOrder and intent=subscription and everything worked as expected. So at some point this code works, but not for createBillingAgreement part.

Expected behavior
Providing createBillingAgreement and intent=tokenize should work as expected

Desktop (please complete the following information):

  • OS: Windows, but I don't think it's related
  • Browser: Tested in Opera and Chrome
  • React Version: 16

Screenshots
image

Additional context
Just for reference

<PayPalButton
  // createOrder={false}
  createBillingAgreement={() => {
    ...whatever works
  }}
  onApprove={(data) => {
    ...whatever is needed
  }}
  onCancel={() => {
    ...whatever gets canceled
  }}
  options={{
    clientId: stuff,
    commit: false,
    vault: true,
    intent: 'what is needed per case',
  }}
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant