We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Re: Checkout Extensions - Determine selected payment method

Checkout Extensions - Determine selected payment method

jacobherrera
Shopify Partner
1 0 1

I'm working on a Checkout UI extension to be used in conjunction with a custom payment method. The store supports both Credit Cards and this custom payment method. The goal is that when the customer selects the custom payment method, an event is fired or picked up from the Checkout UI extension rendered on the screen and a textbox would be displayed to allow the user to enter the data needed for the custom payment method. There isn't much support around payments in the Checkout extension points API. 

 

The general approach follows the Delivery instructions example. The goal is that instead of a checkbox, the visibility be driven by the custom payment method radio button.

Replies 6 (6)

NathanStone
Shopify Partner
1 0 0

We are looking for this exact functionality on our store. Have you had any success that you can share in this post?

vixnguyen
Shopify Partner
45 4 6

Hi Jacobherrera,

In your case, you can use useSubscription with useExtensionApi to watch changes. It's working as your expectation. Please try!

const { selectedPaymentOptions } = useExtensionApi();

const _selectedPaymentOptions = useSubscription(selectedPaymentOptions);

useEffect(() => {

     // handle logic here when having changes on selectedPaymentOptions

}, [selectedPaymentOptions]);

Regards,

garyrgilbert
Shopify Partner
433 41 191

That only gives you the type of payment method it is and not the payment method name.

 

So for example if you had two manual payment methods, you would not be able to determine which is which since the handle returned is not the actual name of the payment method as it is show in admin or in a payment function.

 

Cheers,

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Mladen_Terzic
Shopify Partner
21 1 4

Hey man, were you able to find a workaround here? 

Shopify Expert
garyrgilbert
Shopify Partner
433 41 191

No workaround that I know of. 

 

they do not want us to know the name of the payment method because that might allow us to do something they do not want us to.

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution

bhumika_dvb
Shopify Partner
3 0 0

@jacobherrera  found any workaround here? I'm looking for same issue for our app.