#hamid-sofort
1 messages ยท Page 1 of 1 (latest)
hello @lethal pewter! what specific question regarding the below can i help with?
So now, if you accept a 10โฌ payment with Sofort, the PaymentIntent is associated with pm_123 for Sofort, and in turn, if you also passed setup_future_usage: 'off_session' we know you want SEPA debit and we will create a new PaymentMethod for SEPA Debit and that one will be attached to the customer
okie, great, question i have is, yesterday i was discussing this with one of you guys, and he/she gave me above statement..
actually i want to use sorfot for later payments
or future payments
Also for that i an following this doc
so question is: how and where i can passsetup_future_usage: 'off_session'
to get such payment_method so that i can attach it to customer and can charge later by using setup intent
As, yesterday when i tried, it go following error and i started discussion with you guys.
can you share the exact req id where you got that error message?
ohhhh, not sure, let me see if i have logs
this is the max info i have
I, [2021-10-27T13:45:34.183629 #19] INFO -- : SSS: Stripe: attach_payment_method: cus_KTKOwI7Ux0Txw1 payment_method: pm_1JpCR9B9MHxVN54cFEuwJ72h
I, [2021-10-27T13:45:34.183776 #19] INFO -- : SSS: Stripe: retrieve_customer: cus_KTKOwI7Ux0Txw1
W, [2021-10-27T13:45:34.828140 #19] WARN -- : spaceos_error_uuid: 39a25a3c-2072-4176-bb3a-1dd4a875d493: Stripe::InvalidRequestError: PaymentMethods of type 'sofort' cannot be saved to customers.
hrm
you seem to already have already successfully done it for the latest attempt though
i'm looking at pm_1JpTHNB9MHxVN54cjlOySNWK specifically
when it was done?
i mean the payment_method i gave, which generated error was old, and new one was generated, which could be attached?
if you login to your Dashboard
it's the latest log
you can see the confirmation was successful
confirmation of what?>
sorry, that was confusing. What i meant was that you have successfully attached pm_1JpTHFB9MHxVN54c5P3lya3G (Sofort) to the customer in the latest request : req_cvmNc8tvyAHOdy
cus_KTKOwI7Ux0Txw1
one sec, how this happened, automatically?
are you sure no one else in your team is testing?
Front end is testing
my point here is
i am doing backend
I didn't write the code yet to attach payment method with customer
as it giving error
see i just tried and got this
irb(main):003:1* "cus_KTKOwI7Ux0Txw1",
irb(main):004:1* payment_method: "pm_1JpTHFB9MHxVN54c5P3lya3G"
irb(main):005:1> )
2: from (irb):2
1: from app/adapters/stripe_gateway/stripe_adapter_core.rb:179:in `attach_payment_method'
Stripe::InvalidRequestError ((Status 400) (Request req_aluYWNTWAKO4PI) PaymentMethods of type 'sofort' cannot be saved to customers.)
request_id=req_B6gToGm3VNLtSr
you prbably shouldn't do it that way - https://stripe.com/docs/payments/sofort/set-up-payment#create-setup-intent
You would want to create the SetupIntent with the customer as a parameter
not create the PaymentMethod and then attach it to the Customer later
setupintent was created in the first step
setup inetnt was already generated as first step and is attached with customer
for sepa_debit we attach payment_methods as well to charge it later
that won't work - you need to follow the exact steps in that guide. Sofort is not a PaymentMethod that supports recurring payments. When you use stripe.confirmSofortSetup to confirm the SetupIntent with the Sofort PaymentMethod details, it converts the Sofort details into a SEPA DD PaymentMethod automatically
yea thats fine
i got it
it already happening
so point here is how we can create payment intent without attaching payment_method?
also if its automatically attached, can user attach multiple sorfot accounts as well?
that guide setups / attaches the PaymentMethod to the customer. When you create a PaymentIntent, you would include the customer [0] and payment_method [1]
[0] https://stripe.com/docs/api/payment_intents/create#create_payment_intent-customer
[1] https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method
remember you gave me customer above?
and payment_method
I tried to created payment intent with them like this
payment_method_types: ['sepa_debit'],
amount: 1099,
currency: 'eur',
customer: 'cus_KTKOwI7Ux0Txw1',
payment_method: 'pm_1JpTHFB9MHxVN54c5P3lya3G',
confirm: true,
})```
and this is what i got
``` 1: from (irb):17:in `rescue in irb_binding'
Stripe::InvalidRequestError ((Status 400) (Request req_6nkmoXV8WrqfMo) The provided sofort PaymentMethod cannot be used again. It was used in a previous PaymentIntent or SetupIntent to set up a sepa_debit PaymentMethod, which can be used for multiple payments. To find the ID of the sepa_debit PaymentMethod, list the sepa_debit PaymentMethods associated with the Customer used to set up this PaymentMethod.)
as the error message mentioned, you need to use the ID of the generated sepa_debit PaymentMethod which is pm_1JpTHNB9MHxVN54cjlOySNWK
pm_1JpTHFB9MHxVN54c5P3lya3G -> this is the id of the sofort payment method
okie thats understandable and from wher ei can get setp debit payment method?
this way
id: '{{SETUP_INTENT_ID}}',
expand: ['latest_attempt'],
})```
so we need to find payment method of sepa from setup intent we created in first step
yep!
please stay with me
generated_sepa_debit
?
pm_1JpTHNB9MHxVN54cjlOySNWK
?
yes great
it worked, like payment intent worked
okie great
i am able to attache and create payment intent against the pm_1JpTHNB9MHxVN54cjlOySNWK
which is generated_sepa_debit
thanks a lot
thanks a lot ๐
last question, how can i get email script of our complete chat?
that's not possible in Discord, i'd suggest just copying everything we talked about and pasting it somewhere in a document