#Rahul Maru

1 messages · Page 1 of 1 (latest)

river oceanBOT
final oxide
#

Hello can you send me the request ID (req_123) of the request when you got that error?

#

Or the line of code that you are calling when you get this error?

graceful robin
#

hy can you please share me the example value which i need to pass in stripe.paymentIntents.create

if it is apple pay case

#

currently i am sedning this data

{"amount":19900,"currency":"AED","payment_method_data":{"type":"card"},"payment_method_types":["card"],"off_session":true,"confirm":true,"capture_method":"automatic","description":"Charge for Order-MID-0000000785 on Emporium","shipping":{"name":"Chetan Puwar","address":{"line1":"510 Townsend St","postal_code":"98140","city":"San Francisco","state":"CA","country":"US"}},"customer":"cus_MuLDCrghO9Cfbf"}

#

and getting error Missing required param: payment_method_data[card]. {"code":400}

#

can you please help me in it

#

hello are you there

#

???

#

@final oxide

sour crest
#

👋

#

Stepping in as Pompey needs to step away

graceful robin
#

hy can you please check the above issue

sour crest
#

Sure, can you provide the request ID for the error as Pompey asked for: https://support.stripe.com/questions/finding-the-id-for-an-api-request ? That makes it a lot easier for us to help

#

Never mind, I found it.

#

So since you passed payment_method_data.type: card here and confirm: true it is expecting you to also pass raw card details as part of payment_method_data

#

Really you shouldn't be doing that

#

You should be passing a PaymentMethod object in the payment_method parameter

#

Let's back up a second

#

What are you trying to do exactly?

graceful robin
#

wait let me check

#

{"amount":19900,"currency":"AED","payment_method_data":{"type":"card"},"payment_method":"tok_1MK3AmFsdWHZFlc3DrAEYbic","payment_method_types":["card"],"off_session":true,"confirm":true,"capture_method":"automatic","description":"Charge for Order-MID-0000000786 on Emporium","shipping":{"name":"Chetan Puwar","address":{"line1":"510 Townsend St","postal_code":"98140","city":"San Francisco","state":"CA","country":"US"}},"customer":"cus_MuLDCrghO9Cfbf"}

#

error message: Missing required param: payment_method_data[card]. {"code":400}

sour crest
#

Can you remove payment_method_data here?

#

You shouldn't need that hash at all for what you are doing

graceful robin
#

{"amount":19900,"currency":"AED","payment_method":"tok_1MK3FRFsdWHZFlc3gLNYAoqG","payment_method_types":["card"],"off_session":true,"confirm":true,"capture_method":"automatic","description":"Charge for Order-MID-0000000787 on Emporium","shipping":{"name":"Chetan Puwar","address":{"line1":"510 Townsend St","postal_code":"98140","city":"San Francisco","state":"CA","country":"US"}},"customer":"cus_MuLDCrghO9Cfbf"}

#

error message : A token may not be passed in as a PaymentMethod. Instead, use payment_method_data with type=card and card[token]=tok_1MK3FRFsdWHZFlc3gLNYAoqG. {"code":400}

sour crest
#

Ah this is an Apple Pay flow

#

So you are missing a step here

#

You want to create a PaymentMethod with your Token

graceful robin
#

i want to capture amount with this token

#

how can i do that can you please tell me the steps which i have to follow

#

@sour crest are u there

sour crest
#

Server is busy and I'm helping others as well, one sec

graceful robin
#

yes but i am completely lost with this link since 2 days

#

and finally stuck here

sour crest
#

Okay gotcha, are you trying to charge immediately?

#

I see that you are creating a SetupIntent

#

Are you trying to collect via Apple Pay and then charge later?

graceful robin
#

yes i am trying to charge immediately

#

via apple pay

sour crest
#

Okay in that case you don't want to use a SetupIntent. Instead you create a PaymentIntent and pass its client_secret to your client

#

Then you use that client_secret with STPApplePayContext

#

And the payment will be completed client-side after the customer completes the Apple Pay modal

#

So first, let's change the SetupIntent creation to a PaymentIntent

#

Let me know when that's done!

graceful robin
#

ok let me check

#

hey if we want to first collecti via apple pay and then charge it later then what will be the flow

#

because if i am doing immediate charge the complete process wll be happen on ios device only which we dont want

sour crest
#

Okay then in your STPApplePayContext block instead of calling completion() you fetch your server and pass it the StripeAPI.PaymentMethod which should be a PaymentMethod object (pm_xxxx) that you then use like you were doing above and pass it to a PaymentIntent in the payment_method parameter.

graceful robin
#

ok got it thanks man i will try