Skip to content

How to validate paymentMethod billing address fields #39

Open
@rrigoni

Description

I'm following your examples here and I'm trying to validate the payment method billing address and display errors but only a generic error message is displayed in the PaymentRequest dialog saying There was an error while placing your order. Please try again!.

Displaying errors for the shipping address works just fine.

I'm trying to add the following error object for testing in the paymentRequest.retry(errors).

let errors = {
                paymentMethod: {
                    cardNumber: "asd",
                    cardholderName: "asd",
                    cardSecurityCode: "asd",
                    expiryMonth: "asd",
                    expiryYear: "asd",
                    billingAddress: {
                        addressLine: "asd",
                        region: "ads",
                    }
                }
            };

I tried to register the request.onpaymentmethodchange event but it never gets called.

Do you have an example on how to achieve that? Or any suggestion on the correct way to implement the billing address validation for the selected payment method?

Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions