#carllewisc
1 messages ยท Page 1 of 1 (latest)
Hi ๐
You need to set up the user's payment method for off-session charges. Do you have an example of the setup intent you are using?
sure. i will share code than i using
API (Screenshot)
Client (React native SDK)
export function ConfirmPaymentFuture() {
const user = useSelector(state => state.user.user);
const {initPaymentSheet, presentPaymentSheet} = useStripe();
const [loading, setLoading] = useState(false);
const fetchClientSecret = async () => {
const response = await raixerApi.setupPaymentSheet(user.stripeCustomerId);
if (!response.ok) {
return null;
}
const {setupIntent, ephemeralKey, customer} = await response.data;
return {
setupIntent,
ephemeralKey,
customer,
};
};
const initializePaymentSheet = async () => {
const {setupIntent, ephemeralKey, customer} = await fetchClientSecret();
const {error} = await initPaymentSheet({
merchantDisplayName: 'Example, Inc.',
customerId: customer,
customerEphemeralKeySecret: ephemeralKey,
setupIntentClientSecret: setupIntent,
});
if (!error) {
setLoading(true);
}
};
const openPaymentSheet = async () => {
const {error} = await presentPaymentSheet();
if (error) {
AlertService.error(`Error code: ${error.code}`, error.message);
} else {
AlertService.success(
'Success',
'Your payment method is successfully set up for future payments!',
);
}
};
useEffect(() => {
initializePaymentSheet();
}, []);
return (
<View>
<Button
variant="primary"
disabled={!loading}
title="Set up"
onPress={openPaymentSheet}
/>
</View>
);
}
The ID would be better
should i change something?
You should provide a setup intent ID. It'll start with seti_
OK. i understand
seti_1N6yyHBDYIj360H0Up9Pdz2f
you can see default payment method (with setup intent) but when i create a subscription status is incomplete.
if user have a default payment method (with setup intent) subscription status should be active, right?
you can see usage (off session)
Okay I can see that. And it's set as the Customers default in invoice_settings.default_payment_method
Can you share the ID of one of the subscriptions?
sure, sub_1N6xkoBDYIj360H09zHePRJ8
Ok.
It looks like you're testing with the 4000000000003220 test card, right?
That test card requires 3DS on ALL transactions, even if it has been setup w/ a setup intent
That is right, but i have done testing with different cards and always i have same result
Even the 4242 card?
yes, like that its
Can you share an example of subscription that was incomplete with the 4242 card?
I have deleted the customer with which I was using the card (4242)
i going to delete all data and then try it again
You don't have to delete all data if you don't want to - but yeah, try again with the 4242 card
OK. I'll tell you in a few minutes if everything was ok
@minor hedge Did you still need help?
I think that with the comments that they have told me, it helps me to continue advancing on my side.
thank you so much
However, I am going to comment on a scenario that happened to me a few minutes ago.
when creating the first subscription the status was incomplete then it was active
Then I leave more detailed if the scenario repeats itself