#usama_code

1 messages ยท Page 1 of 1 (latest)

lyric wharfBOT
#

๐Ÿ‘‹ 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.

distant oasis
#

What do you mean by top up functionality? Are you following any docs for this?

strong umbra
#

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

distant oasis
strong umbra
#

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

distant oasis
strong umbra
#

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!!');

distant oasis
#

Can you share your account ID you're working with?

strong umbra
#

This is what happens after selecting the card

distant oasis
#

It clearly is asking for shipping address there

#

Click on add shipping

strong umbra
#

Yes its done
I was adding these
// requiredShippingAddressFields: [
// PlatformPay.ContactField.PostalAddress,
// ],
// requiredBillingContactFields: [
// PlatformPay.ContactField.PhoneNumber,
// ],
thats why it was asking for shipping address

#

Thankyou so much for your help

distant oasis
#

๐Ÿ‘ anything else we can help you with?

#

NP! ๐Ÿ™‚ Happy to help