Skip to content

paypalcommercecredit payment provider: click_initiate_payment_reject #1847

@fresh5447

Description

@fresh5447

I am successfully initializing the paypalcommercecredit payment option, however when I click the "Pay Later" button that is injected, the paypal modal opens and is stuck in a spinning state, and I receive the following error:

Screenshot 2023-02-15 at 3 24 27 PM

Here you can see the payment successfully injecting the pay later option:

Screenshot 2023-02-15 at 3 24 15 PM

This is what my initialization is:

                   const options = {
                        methodId: 'paypalcommercecredit',
                        paypalcommerce: {
                            container: '#checkoutButton--paypalcommercecredit',
                            clientId: clientId,
                            initializesOnCheckoutPage: true,
                            currencyCode: 'USD',
                            submitForm: () => {
                                console.log("paypalcommercecredit submitForm Triggered")
                                getRoot(self).setLoading(true)
                                // Example function
                                getRoot(self).service.submitOrder({payment: { methodId: 'paypalcommercecredit' }})
                                    .then(() => {
                                        return window.location.assign('/checkout/order-confirmation');
                                    }).catch((err) => {
                                        console.error("Order Submit Error", err)
                                        return window.location.assign('/cart.php');
                                    })
                            },
                            onComplete: () => console.log("On Complete Fired"),
                            onRenderButton: (resolve, reject) => {
                                console.log("paypalcommercecredit ON RENDER BUTTON??")
                                const hasError = getRoot(self).service.getState().errors.getInitializePaymentError();
                                if (hasError) {
                                    console.error("PayPal on onRenderButton:", getRoot(self).service.getState().errors.getInitializePaymentError())
                                } else {
                                    console.log("paypalcommercecredit  onRenderButton success")
                                }
                            },
                        },
                    }
                    
                    await service.initializePayment(options);

I have also ensured the PayLater option is enabled in BigCommerce

Screenshot 2023-02-15 at 3 28 58 PM

Currently running @bigcommerce/checkout-sdk" version": "1.183.0"

Any tips on debugging this would be great, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions