#mitsu_api
1 messages ยท Page 1 of 1 (latest)
๐ 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/1293125735590002729
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- mitsu_code, 5 days ago, 23 messages
hi! you don't need to , you can just use the ID pm_card_visa in whatever API where you need the PaymentMethod.
I want to add multiple credit cards for customers
$cardToken = $this->stripe->tokens->create([
'card' => [
'number' => $cardDetails['number'],
'exp_month' => $cardDetails['exp_month'],
'exp_year' => $cardDetails['exp_year'],
'cvc' => $cardDetails['cvc'],
]
]);
=>
$paymentMethod = $this->stripe->paymentMethods->create([
'type' => 'card',
'card' => [
'token' => $cardToken->id
]
]);
no. Never use tokens and raw card numbers that way in backend PHP code. Just do $paymentMethodId = "pm_card_visa"; and you can use that.
how to create pm_id
not that way, never that way.
you don't need to create anything.
$paymentMethodId = "pm_card_visa";
then you use that ID in whatever you were going do next in your code, e.g. confirming a Payment/SetupIntent.
I want to add this card for cus_QskLl9qU8WPTwZ how to do?
are you trying to do this in a backend test only, or are you building a real payments page like in that screenshot and asking how to build it?
i am building a real payments page like in that screenshot and asking how to build it
then you would follow the guide : https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements
I tried searching chatgpt and it looks like this, right?
Is it correct to call the API like this?
no.
like I said, you would never pass raw card numbers like this. ChatGPT is wrong(the API call is technically correct, but this is not how you should ever use it because you should never access/use raw card numbers).
This is the form the customer asked me to make
What does this credit card used to call api paymentintent mean?
I can't understand your question, sorry.
you should not build your own HTML form for this, you should use our Elements components that collect card details securely.
this is my business, can't use stripe element
how to handle?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
stripe documentation also says this, why can't I use it?
why can't you use Stripe Elements?
why can't I use it?
because it puts you in PCI scope:
https://docs.stripe.com/security/guide#pci-compliance-requirement-by-integration
https://support.stripe.com/questions/enabling-access-to-raw-card-data-apis
that is, now i have a form, and want to create pm_id to add to cus_id, finally to call api paymentIntents->create
please guide me
using Stripe.js
like this right?
Hey! Taking over for my colleague. Let me catch up.
You shouldn't collect the card detals (card number, exp, cvv) and send them by your self to create a PaymentMethod
I invite you to use Stripe Element
Yes the guide I'm sharing with you is using StripeJs
You should be following this guide:
https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=elements
$this->stripe->paymentMethods->attach(
$request['pm_id'],
['customer' => 'cus_QskLl9qU8WPTwZ']
);
After having pm_id, I can add it to the customer and call PaymentIntent, right?
No, you shouldn't attach the payment method like that.
You need to use SetupIntent in order to attach the PaymentMethod to the customer.
I have a recent project that I did the same thing, is it wrong?
https://docs.stripe.com/api/payment_intents/create
I think this is still correct?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
no, accoring to the code you've shared previously, you are not using Setupintent and Elements in order to collect the PaymentMethod.
However, this part is correct for creating a PaymentIntent ๐
at that time i used stripe element
With SetupIntent ?
Now the project customer requires to use their form instead of stripe element, then will use stripe.js as you instructed
no,
Ok, let's start from scratch, what you want to achieve exactly ? Collect a Payment Method and then use it later or charge the customer immediatly ?
- my form, use stripe.js to create pm_id
- then add pm_id with cus_id
- paymentIntents->create
Why not following this guide then?
https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements
It's uses StripeJs and Stripe Element
How can this form use stripe element???
You can achieve that following the guide I shared with you
Or you can follow this quickstart:
https://docs.stripe.com/payments/quickstart?client=html
You replace that for with this div:
<div id="payment-element">
<!--Stripe.js injects the Payment Element-->
</div>
And you follow the guide step by step in order to render Stripe Element there.