#red_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/1432909889453166744
๐ 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.
- red_payment-element-load-event, 1 day ago, 48 messages
- red_api, 1 day ago, 26 messages
what am I missing?
createPaymentMethod is a legacy flow. We can suggest a better flow if we know what you want to achieve ๐
Why do you want to collect card info before creating a PaymentIntent?
so, I am in the Surcharge Beta, so I am following instructions - and they use that flow (as whether surcharge is available is on the paymentIntent returned)
I had everything set up so I use confirmation token instead, but I can't see how to use that with surcharge beta
BUT I obviously need to know if a card was used so I can create the Intent
hopefully that makes sense!
I'm all ears if you can suggest something better!
I am in the Surcharge Beta, so I am following instructions - and they use that flow
Can you share the Doc you are following here?
Okie let's say you are following this step by step. In which step are you stucked?
Sorry I didn't know you are on a beta. When you are on a beta, it's best to follow the beta Doc
that's what I'm trying
ah I think I figured it out
I had included
enabled: true,
allow_redirects: 'never'
},```
I removed that and now get the payment-specific intent!
any idea why confirmationToken won't work with surcharge implementation though?
Technically it could work. Have you tried and which error do you encounter?
I would much prefer to use that method
but when I pass the confirmationToken to the server, I looked like I could only call stripe.paymentIntents.create with the confirmationToken and I have to confirm it at the same time?
whereas I need to apply the surcharge first - and to do that, I need the paymentIntent (hopefully that makes sense)
am I missing something?
also, going back to the documented implementation, if I have multiple payment options, how do I tell if a surcharge is available without a big if-else?
Ah I see
when I pass the confirmationToken to the server, I looked like I could only call stripe.paymentIntents.create with the confirmationToken and I have to confirm it at the same time?
Yes because that's the "confirmationToken" ๐ It doesn't suit when you need to create the PI first with card info then confirm later
if I have multiple payment options, how do I tell if a surcharge is available without a big if-else?
I imagine you would check the returned PI withpayment_method_options.card.surcharge's status and maximum_amount, correct? Which if-else do you forsee?
ah, yep, so I guess only cards are surchargable at this time, even though things like CashApp have a fee associated with them
sounds like I should give up on the confirmationToken approach?
Yes
ok
I think it's working
does this look right?
"id": "pi_3SNPVWBBPymgN3Ps0523XeaX",
"object": "payment_intent",
"amount": 125000,
"amount_capturable": 0,
"amount_details": {
"surcharge": {
"amount": 0
},
"tip": {}
},
"amount_received": 0,
"amount_surcharge": 3750,
I'm a bit surprised by:
"amount_details": {
"surcharge": {
"amount": 0
},
where can I see the surcharge details in the Stripe dashboard?
also, the payment shows as Incomplete?
Let me look at the PI
Ok that's expected. PI is incomplete because it hasn't been confirmed yet. (Step 7)
ah
I need to do that server side - no issue, correct?
and because this is in an iFrame there's no return url
Technically should work, after you have displayed the applied surcharge on step 6
I have things set up so I show the surcharge in the UI in the very first step ๐
that way customer see what they will charge - and can chose ACH if they prefer
hence having to bend the instructions a little
after I submit the UI, I create the PaymentIntent, update with surcharge (checking that the amount applied in the UI <= max allowed) and then confirm all in one backend step
ha, except I can't use stripe.confirmPayment on backend apparently
can I just do stripe.paymentIntents.confirm( 'pi_3MtweELkdIwHu7ix0Dt0gF2H')?
Yes backend has its own version of Confirm Payment Intent
looks correct, depends on the backend SDK
node.js
do I need clientsecret?
struggling to find the right docs for it
would you have a link please for server-side node.js call?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
so this:
paymentIntent.id,
{
payment_method: paymentIntent.payment_method.id
}
);```
Yes that should work
with the same Id
no client_secret needed. That's for client-side confirmation
and: This PaymentIntent is configured to accept payment methods enabled in your Dashboard. Because some of these payment methods might redirect your customer off of your page, you must provide a return_url. If you don't want to accept redirect-based payment methods, set automatic_payment_methods[enabled]totrueandautomatic_payment_methods[allow_redirects]tonever` when creating Setup Intents and Payment Intents."
will add
oh wait, I had to remove that to get the payment-specific intent?!
any ideas?
hmm
Can you try the suggestion
set automatic_payment_methods[enabled] to true and automatic_payment_methods[allow_redirects] to never
When creating the Payment Intent?
Either this or specifying a returnUrl
qq before I answer that - how do I see the surcharge info in the dashboard?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I don't see it for some reason?
(for a successful payment)
Yes we haven't shown that in Dashboard. You can leave it as a feedback to Support team if you already have a conversation with them on enabling this beta
Listening to payment_intent.succeeded webhook event, and look up the surcharge properties there
You can use the Retrieve PaymentIntent API. I think it's possible via API all kind, just Dashboard doesn't looks obvious
yeah, needs to be on dashboard
yes, remember my initial issue was that the particular payment was shown in the payment intent when I created it with automatic_payment_methods enabled?
I think surcharge is tighted to card and you will need a returnURL anyway. Just prepare an endpoint could be the easiest workaround
card doesn't need a returnUrl though?
Let's try another thing, when you create the Payment Intent, can you explicitly send
payment_method_types: ['card']
?
Currently you haven't specified it: https://dashboard.stripe.com/acct_1RZepBBBPymgN3Ps/test/logs/req_DXsTauXFpoFLE9
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
So do you want to keep using Dynamic Payment Methods, which can enable all card, ACH and CashApp?
yes, have to on the front end
it does get set via Payment method - look at pi_3SNQBqBBPymgN3Ps1U1J3wi5
something funky going on
Okie, so if you pass these 2 parameters on the Create Payment Intent API, what happens?
No I mean specifying those 2 parameters on the step of creating Payment Intent (here in the Doc: https://docs.stripe.com/payments/collect-surcharges?payment-ui=payment-element#create-paymentintent-and-attach-paymentmethod)
Looking at pi_3SNQBqBBPymgN3Ps1U1J3wi5 and I think you haven't set those 2 parameters: https://dashboard.stripe.com/acct_1RZepBBBPymgN3Ps/test/logs/req_DXsTauXFpoFLE9
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
yes, that's what I tried the first time, but maybe I wasn't expanding the payment method in the call at that time?
Sorry I am confused, have you tried including 2 parameters on the Create Payment Intent API? If you have, please share the request id (req_xxx)
automatic_payment_methods[enabled]=true
automatic_payment_methods[allow_redirects]=never
Hi! Stepping in for my colleague. Give me a while to catch up. Thanks!
ok that did work
pi_3SNQrSBBPymgN3Ps0tf2SqYD
can I send a receipt from the dashboard?
nm, I found it
but can I programmatically add to the receipt line items?
You can add a receipt_email when creating your payment intent: https://docs.stripe.com/api/payment_intents/create#create_payment_intent-receipt_email
thanks, but I was looking for a way to affect the receipt by adding line items to it?