#thamila-applepay-web
1 messages · Page 1 of 1 (latest)
Hey @lucid lance what's your question?
hey it's about appelpay payement with stripe
when i get a token appel pay that i convert it to a stripe token but when i get my resulat how can i use it to do the payement
Which doc are you following?
stripe ..
"stripe .." is not really a doc
i use the officeil documentation of stripe https://stripe.com/docs/payments/payment-methods/overview
that's just an overview page
Sorry to push but I assume you're a developer and integrating Stripe, so you must have started with a real doc, with end to end examples.
If not, how did you know to create a Token?
You didn't explain much yet unfortunately. Like what platform do you use? Is this an iOS app? A Flutter app? A web app? Something else?
Please try to take a step back and provide detailed information all in one unique message
i have a token as a string i want to use it to do a payement howa can i use it , am not the one how create that token i got it when i use appelpay
thamila-applepay-web
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#apple-pay-and-google-pay
You shouldn't even be creating a Token. Tokens have been deprecated for over 4 years. That's why I keep trying to ask you for detailed information around which guide you are following
okey thank you
I can help, I just need you to provide more actionable information
the thing is that when i use a appelpay payement i don't use any of js methods like payement button or payement request i use only server so when i got a token by appelpay i convert it to a stripe token my self using Http request now when i get my stripetoken i wonder if i have to create a tokenOptions with it or no
see, you clearly have a ton of information that you haven't shared with me in 20 minutes. Please help me help you and provide a lot more specific details.
Why do you create a Token server-side? How? Who sends you the Apple Pay information like the DPAN for you to do this? Where did you get the code for it? Please give me real details
u
?
so i create a token server side because infact in my app i have another providers like paypal so i juste do a payement in my application and that give me a ton of information like card information and costumer id and else now when i use appelpay that give me the token that appelpay generate so i allready asked your collegue and he told me how to do it
i need to convert Apple Pay token to Stripe token. i can do it like this:i use this undocumented parameter in Tokens API
Okay, sorry but it's been 30 minutes and it's the first time you mentioned any of this
https://stripe.com/docs/api/charges/create pass source: 'tok_123' and then you're done.
yes
but when i convert it i got it like a string
i juste can't do token.id because it's a string
I have no idea what this means
Like your code must be creating a Token via our API and get a Token object https://stripe.com/docs/api/tokens/object back
no that's not the thing i mean yes i do a convert but the object i get a last is a string
so that's why i ask
Okay I'm sorry but it's been almost an hour with no information. I'm sorry @lucid lance but I need you to provide real information and questions.
Please share the exact code you are using to create a Token and what you get back
curl -u sk_xxx: https://api.stripe.com/v1/tokens \ -d pk_token=ApplePayPaymentToken.paymentData (decoded as JSON) \ -d pk_token_instrument_name=ApplePayPaymentToken.paymentMethod.displayName \ -d pk_token_payment_network=ApplePayPaymentToken.paymentMethod.network \ -d pk_token_transaction_id=ApplePayPaymentToken.transactionIdentifier
that what i use
i got this
"id": "tok_1MEZmSFVCCFguyvQuq4RH0LE",
"object": "token",
"card": {
"id": "card_1MEZmSFVCCFguyvQwDPVnHC7",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "MasterCard",
"country": "FR",
"cvc_check": null,
"dynamic_last4": "3291",
"exp_month": 12,
"exp_year": 2025,
"fingerprint": "ZA6tpxRaD4cCek51",
"funding": "prepaid",
"last4": "2450",
"metadata": {
},
"name": null,
"tokenization_method": "apple_pay"
},
"client_ip": "185.246.18.160",
"created": 1670942908,
"livemode": false,
"type": "card",
"used": false
}
but that's just a curl call. Are you just testing by hand? Because no one would write a curl command in a terminal for a real web application
am testing it juste to see what will i get
but then there's no issue with "returning" a string? It's just an example. You're the human here and you can see the Token id right there in what you told me
"id": "tok_1MEZmSFVCCFguyvQuq4RH0LE",
so really you take tok_1MEZmSFVCCFguyvQuq4RH0LE and that's the value you want
Also that request was made via Postman, not via curl but you said you used curl
I'm sorry, it's really hard to help with 10% of the info
i used it all i used also a http request
Okay, so what's the problem?
var url = new Uri("https://api.stripe.com/v1/tokens");
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", key);
var values = new Dictionary<string, string>
{
{pk_token_instrument_name=ApplePayPaymentToken.paymentMethod.displayName
},
{ "pk_token_instrument_name", "Mastercard xxx },
{ "pk_token_payment_network", "Mastercxxx"},
{ "pk_token_transaction_id", "idxxxx"}
};
var data = new FormUrlEncodedContent(values);
var result = await client.PostAsync(url, data);
it's like this so now how can i juste do apyement with my result
what's apyement?
like the result seems to be in the result variable right? And we return JSON
payement excyse me *
so your code can deserialize the JSON and access the id right?
I have no idea what this means again
this is your own code in a programming language you are likely familiar with
the last line does an HTTP POST request
so you get the result back. This isn't really a Stripe question so I assume you have done HTTP POST requests before in that language. If not can you give me more details? Which language is this? Which doc are you following?
I just googled and it seems you simply want https://stackoverflow.com/a/26598059/1606729 which shows you exactly how to access the response
and https://www.newtonsoft.com/json/help/html/QueryJson.htm seems to explains how to read JSON assuming you use that library
okey thank you excuse me i dont realy talk english well so somtimes i mix things up
No worries your English is totally fine! Earlier I just got confused by the typo because your code didn't reference a "payment" variable
If it were me, I'd pause all of this and use our official stripe-dotnet library instead. You seem quite lost with all of this, and at least our library makes the request for you and since you'll need it for Charge creation too it will be way simpler: https://github.com/stripe/stripe-dotnet/
i see, i have to do an AddExtraParam() in place of httprequest thats it ?
yeah that will be a lot simpler so that's what I'd do
okey thank you
Sure!