#venkateshjsoft

1 messages ยท Page 1 of 1 (latest)

fervent scaffoldBOT
dusky depot
#

Yeah it means you need to provide a return_url parameter, since a sofort Payment Method needs one

fallow thicket
#

but this is recurring payment

#

where user involment is not needed here

#

first time user is authenticated then for the recurring payments we will be taking money without user to provide authorisation again

#

I tried the same step with ideal payment it was working fine

#

im following as per this link

dusky depot
#

That outlined how to use Sofort for the first Payment, and then obtain the generated_sepa_debit , a different Payment Method Id, to use later on when your customer is off session

fallow thicket
#

{
"customer_id" : "cus_OPvwjG7CylH03Z",
"paymentMethod_id" : "pm_sofort_generatedSepaDebitIntentsSucceedNetherlands",
"paymentMethod_type" : 5,
"amount" : 3500
}

#

I used this sofort payment test data available

#

Step 1: Initiated paymet with sofort
Step 2: Confirmed the payment with return URL from the frontend.
Step 3: Initiated recurring payment with the generated_sepa_debit (test data available on Stripe website)

#

please confirm if the steps im following is correct

dusky depot
#

Yes correct

fallow thicket
#

im getting error in the step 3

#

it ask me to provide return url again

#

for the recurring payments, we dont provide return url as there is no user is involed in this step

dusky depot
#

Ah I see

#

Just curious, if you pass a random URL in, would it work?

fallow thicket
#

I can try

#

i get response "required_Action"

#

looks like its expecting user to authenticate again

#

req_WqxrX0IPcqHigc

#

i dont want our customers to authenticate again and again for recurring payments

dusky depot
#

interesting...

#

๐Ÿค”

fallow thicket
#

can you check and confirm if im doing something wrong in the flow

dusky depot
#

In step 2 when you confirmed the Payment on frontend, what PaymentIntent object did it give you?

fallow thicket
#

const {error} = stripe.confirmSofortPayment(
clientSecret.value,
{
payment_method: {
sofort: {
country: "NL"
},
billing_details: {
name: accountholderName.value,
email: accountholderEmail.value,
},
},
return_url: 'https://example.com/checkout/complete',
}

dusky depot
#

Yes, which PaymentIntent Id you got?

fallow thicket
#

pi_3Nd6KtDEdWHgNJda0NaxOidS

fallow thicket
#

is this enough?

dusky depot
#

Can you paste the payment_method_details block as the Doc mentioned?

#

I believe it should have

  payment_method_details: {
    sofort: {
      bank_code: "DEUT",
      bank_name: "Deutsche Bank",
      bic: "DEUTDE2H",
      country: "NL",
      generated_sepa_debit: "pm_1Nd6QbDEdWHgNJdaO95tBwSp",
      generated_sepa_debit_mandate: "mandate_1Nd6QbDEdWHgNJdakHGNyJFO",
      iban_last4: "3000",
      preferred_language: null,
      verified_name: "Jenny Rosen"
    },
fallow thicket
#

my response doesnt have this object

fervent scaffoldBOT
vagrant tree
#

I can see that object in your screenshot though, at the bottom.

fallow thicket
#

but the object you have shared exists under charges

vagrant tree
#

ah yeah

#

then retrieve the charge ๐Ÿ™‚

#

the PaymentIntent has a latest_charge field, that's the ID of the charge. You can use expand:["latest_charge"] too

fallow thicket
#

but i dont understand why I need to use latest charge field, what im trying to do is making new payment for the same customer

#

I charged the customer initially and I want to charge them again for the recurring payment using sofort

vagrant tree
#

is the recurring payment happening off-session(initiated from your server automatically like on a monthly cron job)?

fallow thicket
#

yes thats our plan but not cron job, our internal job which initiate recurring payment

#

is it clear?

vagrant tree
#

yep

#

so that payment can not happen through SOFORT

#

SOFORT is only for on-session payments.

#

so instead, you make the recurring payment as a SEPA Debit payment, where you are charging the SEPA IBAN that the customer used through SOFORT on the first payment. That's why you need to access the Charge to get that generated paymentmethod that has the IBAN. It's all described clearly in the docs.

fallow thicket
#

let me check