#eriktoor

1 messages · Page 1 of 1 (latest)

vague tigerBOT
regal ether
#

Can you share the Payment Intent ID (pi_xxx)?

pale atlas
#

Sure -- however, the issue is that on the client the paymentintent id is null

    const { paymentIntent, error } = await confirmPlatformPayPayment(clientSecret as string, {
      applePay: {
        cartItems: cart,
        merchantCountryCode: 'US',
        currencyCode: 'USD',

        requiredShippingAddressFields: [
          PlatformPay.ContactField.EmailAddress,
          PlatformPay.ContactField.PhoneNumber,
          PlatformPay.ContactField.PostalAddress,
          PlatformPay.ContactField.Name,
        ],
        requiredBillingContactFields: [PlatformPay.ContactField.PostalAddress],
        shippingType: PlatformPay.ApplePayShippingType.StorePickup,
        additionalEnabledNetworks: ['JCB'],
      },
    })

Because this returns the error above.

On the server the payment intent id pi_3OPcdvCSVXIaq6vh1xuU3ZXm but I take the clientSecret and pass that and the ephemeral key to the client.

#

This is my server code

router.post(..., () => {
    const ephemeralKey = await stripe.ephemeralKeys.create(
      {customer: customerId},
      {apiVersion: '2023-10-16'}
    );
    console.log(ephemeralKey)

    const paymentIntent = await stripe.paymentIntents.create({
      amount: 1099,
      currency: 'usd',
      customer: customerId,
      // In the latest version of the API, specifying the `automatic_payment_methods` parameter is optional because Stripe enables its functionality by default.
      automatic_payment_methods: {
        enabled: true,
      },
    });

    res.json({

      clientSecret: paymentIntent.client_secret,
      ephemeralKey: ephemeralKey.secret,

    });
})
#

Does that make sense or is something I'm saying way off?

regal ether
#

Which integration guide are you following? Using createPlatformPayToken to create a token is legacy.

The recommended integration for Apple Pay in stripe-react-native should be: https://stripe.com/docs/apple-pay?platform=react-native

Allow customers to securely make payments using Apple Pay on their iPhone, iPad, or Apple Watch.

pale atlas
#

to create a token i use that method so great maybe i messed something up!
i found an example github repo online

#

Oh isn't the only diff here just that I wouldn't use createPlatformPayToken ?

#

im doing everything else

#

because createPlatforPayToken actually succeeds its the other method createPlatformPayPayment that fails

#

Hey @regal ether once I took out createPlatformPayToken it worked!! Thank you so so much this is great.

#

I appreciate the help. I think this thread can be resolved for now.

#

feels good

regal ether
#

Awesome! Great to see everything works!

pale atlas
#

Other q it looks like when I create the client secret on the backend I create an extra payment intent that never gets paid. Should I be creating the client secret a different way?

#

Maybe I'm accidentally calling it a second time somewhere that must be it

regal ether
#

Yup! It's likely somewhere in your system create the Payment Intent for the second time

pale atlas
#

Oh and are ephemeral keys not really needed anymore?

#

because i would love to remove my calls to that

#

not needed for confirming a payment

regal ether
pale atlas
#

I guess my last question is right now I have a one time payment.

I want to do one time payments and subscriptions. Are there any docs you could share on creating a payment intent for a subscription? I see stripe.subscriptions.create({ but this creates a subscription object and not a payment intent.

regal ether