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

Incorrect Types for PaymentRequestButtonElement #3

Closed
danseaman6 opened this issue Feb 7, 2020 · 0 comments · Fixed by #4
Closed

Incorrect Types for PaymentRequestButtonElement #3

danseaman6 opened this issue Feb 7, 2020 · 0 comments · Fixed by #4
Assignees

Comments

@danseaman6
Copy link

Per the examples in the hooks directory, the PaymentRequestButtonElement looks something like this:

{paymentRequest && (
        <PaymentRequestButtonElement
          onClick={(event) => {
            if (paymentMethod) {
              event.preventDefault();
              setErrorMessage(
                'You can only use the PaymentRequest button once. Refresh the page to start over.'
              );
            }
          }}
          options={{
            ...ELEMENT_OPTIONS,
            paymentRequest,
          }}
        />
      )}

After getting a TS compile error and bouncing through the types a bit, it appears the options attribute no longer excepts a paymentRequest. I'll paste a flow of definitions here:


interface PaymentRequestButtonElementProps extends ElementProps {
    /**
     * An object containing [Element configuration options](https://stripe.com/docs/js/elements_object/create_element?type=paymentRequestButton).
     */
    options?: stripeJs.StripePaymentRequestButtonElementOptions;

...

  interface StripePaymentRequestButtonElementOptions {
    classes?: StripeElementClasses;

    /**
     * An object used to customize the appearance of the Payment Request Button.
     */
    style?: {
      paymentRequestButton: {
        type?: 'default' | 'book' | 'buy' | 'donate';

        theme?: 'dark' | 'light' | 'light-outline';

        /**
         * The height of the Payment Request Button.
         */
        height?: number;
      };
    };
  }
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

Successfully merging a pull request may close this issue.

2 participants