#s0__0-PI
1 messages · Page 1 of 1 (latest)
Hi! After you created the PaymentIntent, on your backend sever you can find the client secret in paymentIntent.client_secret. https://stripe.com/docs/api/payment_intents/object?lang=dotnet#payment_intent_object-client_secret
$stripe->paymentIntents->create(
[
'amount' => 1099,
'currency' => 'eur',
'automatic_payment_methods' => ['enabled' => true],
]
);
what i have return is this @@
You need to store the PaymentIntent in a variable, something like this:
$paymentIntent = $stripe->paymentIntents->create( ... );
And then in the $paymentIntent variable there will be a client_secret.
can i directly show card number fields after customer choose stripe method?
customer will choose his payment method and fill in email addr, after that, if he choose stripe, another page showing card number field
Yes, you need to keep reading this documentation page: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
First create the PaymentIntent, then collect payment information with the Payment Element.
okok i can now show my card form, how can i pass the product information back to my server?
should i save the client_secret to my database, and when customer paid, i can check which order No. by comparing the client_secret to know which order is paid?
You can either store the PaymentIntent ID in your database, or you could add metadata to the PaymentIntent: https://stripe.com/docs/api/payment_intents/create?lang=node#create_payment_intent-metadata
okok thanks!
Hey, taking over from @dawn iris here
Something seems off here. Your UI is using the Payment Element yet your code is creating a card element
Ah, you're creating a UPE instance earlier in your code
Why are you creating a Token?
I am very confuse what am i doing
Lots of example and doc
And i mix up everything
Now i can show the card field, but what i have to handle with the submit button?
Okok but what i have to do about the submit button?
You should be following the guide: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
I'm guessing you're following another guide online?
I can't write code for you, so you need to share the exact block of code you're struggling with and what exactly the issue is
yes i am following this page
once i click the submit buttom, the url goes the same, and nothing happen, no success msg
and i havnt set src in the <form> tag
do i need to event.preventDefault();
to disable the submit action?
Can you share the code your submit button triggers?
You need some JavaScript to handle the form submission
I can't see that in what you've shared
Does the error make sense to you?
is it a must to show region select option?
yes, we ask for the country the customer is in since it's required for fraud prevention overall (it helps determine if we need to collect a postal code and in what format, which is used detecting fraud(https://stripe.com/docs/disputes/prevention/verification#avs-check))
how can i add alipay and wechat in my form?
If you have them enabled on https://dashboard.stripe.com/settings/payment_methods and are using a PaymentIntent that's compatible(see the docs for WeChat and Alipay on our site, for example they only work with certain currencies), they will just appear.
i have enable them
currency is hkd
region is hk
but no alipay/wechat button appear @@
what's the PaymentIntent ID pi_xxx you're using so I can check something?
pi_3KlBJZJnRDDqOaR70Pb11sGy
you're not using your own Stripe account
I assume you copy and pasted API keys from our docs somewhere, so you're actually creating that object on one of our test accounts
get your own keys from https://dashboard.stripe.com/test/apikeys and configure the PHP code to use those instead, so that the settings from your own account will apply and the payments appear on your own dashboard
oops, sorry
i can see them now
can i adjust the width to see them all?
width of the form
it fits the width of the container you mount the PaymentElement to, but in general that's how it's designed, it has a dropdown menu for picking other payment methods
what debugging have you done?
if you have a public link to the site I can have a look too.
i just open this link in my andriod phone @@
no form appeared, just only my submit button
opened it on my Android phone and it displays fine
if you want to debug it one option is to connect the phone to your PC and remote debug with https://developer.chrome.com/docs/devtools/remote-debugging/ so you can see the browser console
hello
i have got this error
{
"error": {
"message": "The client_secret provided does not match any associated PaymentIntent on this account.",
"param": "client_secret",
"type": "invalid_request_error"
}
}
but in my pc and your phone, it works fine @@!
my iphone didnt show apple pay method @@
Hi there 👋 jumping in as my teammates needed to step away. The sever is very busy at the moment, would you mind summarizing your current questions/concerns?
the previous problem is settled
the newest question is
my iphone didnt show apple pay method @@
I'm not seeing it either, have you followed the instructions in the "Set up Apple Pay for your website" section from this article to verify your domain with Apple Pay?
https://support.stripe.com/questions/enable-apple-pay-on-your-stripe-account
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
i turn on apple and google pay
for my android phone, i can see google pay
but no apple pay in my iphone
oh i know what u mean now
hnvt do that yet
Alright, you'll need to verify your doamin with Apple before they will allow Apple Pay to be displayed.
ok thanks
how about wechat ?
in pc, It show a qr code only
after i cross it (didnt scan) , it redirect to my return_url
does it mean a bug? or i have to set a fail page?
what does "cross it" mean?
closs the pc code by pressing the "cross" icon
can you share a screenshot of what you're describing?
makes sense, so you cancelled the payment
it will go to your return_url yes
if you look in the URL you probably see information that tells you the payment is not complete(I think there's a &redirect_status=failed or something similar)
or you can use https://stripe.com/docs/js/payment_intents/retrieve_payment_intent to check the current status on that page as well. Depends what you're trying to do.
ok, then you would want my second option
i am following this page @@
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
in test case, if success payment, will my webhook receive a notification?
yep!
how can i redirect a fail page to customer while they cancel paying?
const {error} = await stripe.confirmPayment({
//Elements instance that was used to create the Payment Element
elements,
confirmParams: {
return_url: 'https://yudans.net/complete',
},
});
i have just only set a return_url
you can't, that's not supported right now
after i've received a success msg from my webhook, can i trust it? or i still have to check with stripe again?
you can trust it
in my return_url, i have to handle both success and fail msg, right?
yes
okok
@proven stag going to close this thread for now as it's been ongoing for a long time and you seem to be making progress and are not blocked. Happy hacking!