#usama_code
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1296108082127962163
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
What do you mean by top up functionality? Are you following any docs for this?
In our app there is an option for buying subscription and for purchasing the subscription, we are maintaining the wallet in our app, and for buying subscription we must have money in our wallet which will come through topup
Gotcha. So the doc you're following only creates a PaymentMethod. It doesn't charge the card or anything.. https://docs.stripe.com/apple-pay?platform=react-native#create-payment-method
Are you saying the payment method isn't getting created?
const pay = async (paymentIntentId: string, amount: number) => {
let paymentMethod;
if (Platform.OS === 'android') {
const {error, paymentMethod: androidPaymentMethod} =
await createPlatformPayPaymentMethod({
googlePay: {
amount: amount,
currencyCode: 'USD',
testEnv: true,
merchantName: 'Test',
merchantCountryCode: 'US',
},
});
if (error) {
Alert.alert(error.code, error.message);
return;
}
paymentMethod = androidPaymentMethod;
} else if (Platform.OS === 'ios') {
console.log('IOS PAY!!');
const {error, paymentMethod: iosPaymentMethod} =
await createPlatformPayPaymentMethod({
applePay: {
cartItems: [
{
amount: `${amount}`,
label: 'Top up',
paymentType: PlatformPay.PaymentType.Immediate,
},
],
merchantCountryCode: 'US',
currencyCode: 'USD',
requiredShippingAddressFields: [
PlatformPay.ContactField.PostalAddress,
],
requiredBillingContactFields: [
PlatformPay.ContactField.PhoneNumber,
],
},
});
if (error) {
console.log(error, 'ERROR ON APPLE PAY!');
Alert.alert(error.code, error.message);
return;
}
paymentMethod = iosPaymentMethod;
}
if (paymentMethod) {
confirmPayment(paymentIntentId, paymentMethod.id);
}
};
above is my function it is creating payment also asking for card details but after selecting the card nothing happens
The code looks ~fine but I can't just read it and say if it should work 100%
Have you checked your request log to see if any API calls are failing?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
yes I logged three statements
} else if (Platform.OS === 'ios') {
console.log('IOS PAY!!');
const {error, paymentMethod: iosPaymentMethod} =
await createPlatformPayPaymentMethod({
applePay: {
cartItems: [
{
amount: ${amount},
label: 'Top up',
paymentType: PlatformPay.PaymentType.Immediate,
},
],
merchantCountryCode: 'US',
currencyCode: 'USD',
requiredShippingAddressFields: [
PlatformPay.ContactField.PostalAddress,
],
requiredBillingContactFields: [
PlatformPay.ContactField.PhoneNumber,
],
},
});
console.log("__________NO LOGS HERE_______")
if (error) {
console.log(error, 'ERROR ON APPLE PAY!');
Alert.alert(error.code, error.message);
return;
}
paymentMethod = iosPaymentMethod;
}
console.log("__________NO LOGS HERE_______")
if (paymentMethod) {
confirmPayment(paymentIntentId, paymentMethod.id);
}
only this one logged
console.log('IOS PAY!!');
Can you share your account ID you're working with?