#junaid_abbasi999
1 messages · Page 1 of 1 (latest)
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
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.
Yeah
Just load it as part of your component then instead of requiring the button to be pressed
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?
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
and one last thing can i change default payment method using an api call?
reference to some docs might help..
Yes. Are you processing subscription payments?
no it's for future payments
for a service provided by a user
there are no subscriptions involve
Got it. Are you using invoices? Or payment intents?
payment intents
Gotcha. So if you don't specify a payment method when creating it, customer.default_source is used: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So to set the default, just set default_source on the customer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
thanks for the help
No problem
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?
Yeah it won't be on the card itself