How to process Apple Payment Token for integration with payment processor like Stripe?

76 Views Asked by At

Hey guys long time no see.

In Apple Pay for iMessage, users can initiate an Apple Pay payment on iMessage. Once the user authorizes the payment, my endpoint receives the Apple Pay Token from Apple- this has the user's encrypted payment details. I am having trouble figuring out how to process this token to process the payment.

According to this link, Stripe is authorized and is supposed to fully handle this token on their own, I would simply be forwarding the apple pay token to Stripe. Unfortunately, stripe isn't accepting the payment token as valid. I tried using the Stripe python package and passing in the token as the 'source' but it doesn't work.

 payment_intent = stripe.PaymentIntent.create(
        amount=80,  # in cents
        currency='usd',
        payment_method_types=['card'],
        payment_method_data={
            'type': 'apple_pay',
            'apple_pay': {
                'token': ttt  # Use the Apple Pay token here
            },
        },
        confirm=True,
    )

Anyways, where am I going wrong here nothing else is working and I am not sure what I should do? Do i need to do something to de-encrypt the apple pay token, I am not even sure if I have the regulatory approval to do this. P.S This is not for apple pay web or js integration.

0

There are 0 best solutions below