Skip to content
This repository was archived by the owner on Feb 13, 2022. It is now read-only.
This repository was archived by the owner on Feb 13, 2022. It is now read-only.

Can't update amount with state change #18

@SteveAndreou

Description

@SteveAndreou

Hi,

I've been struggling with updating the amount for the rendered component.

The properties for my wrapping component are updating correctly (seen via react dev tools) and the properties on the PayPalButton are also updating correctly but the createOrder call to paypal (see in the console with debug enabled) is not sending the correct value.

To give context to usage, I have a checkout page with a promo code field which can alter the total cost. The paypal payment button is show below the promo code fields at the very bottom of the page.

I tried using the onshippingchange action to mess with the value but it's not ideal.
Any suggestions?

const paypalOptions: PaypalOptions = {
        clientId: props.apiKey,
        intent: "capture",
        debug: true,
        commit: true,
        vault: false,
        currency: props.currency
    };

    const buttonStyles: ButtonStylingOptions = {
        layout: "vertical",
        shape: "rect"
    };

<PayPalButton
                    paypalOptions={paypalOptions}
                    buttonStyles={buttonStyles}
                    ...
                    amount={props.amount}
                />

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions