#junaid_abbasi999

1 messages · Page 1 of 1 (latest)

cinder crestBOT
vagrant jackal
#

Well that's your code that creates the popup right?

#

You should just be able to change it

#

It's not a stripe-hosted page

lucid copper
#

Yes the button triggers open payment sheet method

#

I didn't understand what you are asking. Can i do it or not?

#

<Button
mode={type === 'modal' ? 'text' : 'contained'}
disabled={loading}
onPress={openPaymentSheet}
icon="plus">
Add Card
</Button>

#

I want paymentSheet opened allready as a part of my component not from the bottom of the screen.

vagrant jackal
#

Yeah

#

Just load it as part of your component then instead of requiring the button to be pressed

lucid copper
#

const openPaymentSheet = async () => {
// see below
const {error} = await presentPaymentSheet();
if (error) {
Alert.alert(Error code: ${error.code}, error.message);
initializePaymentSheet(stipeCustomerId);
} else {
Alert.alert(
'Success',
'Your payment method is successfully set up for future payments!',
[
{
text: 'OK',
onPress: () => {
console.log('stripe id:', stipeCustomerId);
initializePaymentSheet(stipeCustomerId);
getSavedCard();
},
},
],
);
}
};

#

openPaymentSheet does this, I can't make it as part of my component?

vagrant jackal
#

Oh sorry I see what you're saying now

#

One sec

#

No I think that popup is required

#

Unless you use the plain card element

lucid copper
#

and one last thing can i change default payment method using an api call?

#

reference to some docs might help..

vagrant jackal
#

Yes. Are you processing subscription payments?

lucid copper
#

no it's for future payments

#

for a service provided by a user

#

there are no subscriptions involve

vagrant jackal
#

Got it. Are you using invoices? Or payment intents?

lucid copper
#

payment intents

vagrant jackal
#

So to set the default, just set default_source on the customer

lucid copper
#

thanks for the help

vagrant jackal
#

No problem

lucid copper
#

hey just a last thing i used the list api call to get all the added cards by a user. But there is no information in the returned data to know which card is the default one. Can you help me in this issue?

vagrant jackal
#

Yeah it won't be on the card itself