#remi.lapierre

1 messages ยท Page 1 of 1 (latest)

prime pantherBOT
shut merlin
#

Basically you will need to present the 3DS auth to your user either on your page or a stripe hosted one.

#

Is this the first subscription payment or a recurring one?

restive prairie
#

Recurring one

#

In a context where first payment was great and on a recurring event, it didnt pass

shut merlin
#

So either you can send them to the stripe hosted invoice page, or you can send them to your own page where you present the 3DS modal

#

That first doc also mentions that you can turn on a Stripe setting so that we automatically email the user about 3DS being required with a link to complete it

restive prairie
#

I see, how can I detect it on the code?

#

try {
$charge = $organization->account->createCharge($invoiceItem->total * 100, $stripeId, $methodId);
if ($charge == null) throw new GeneralException('Unable to create Stripe payment charge');
} catch (\Exception $e) {
// stripe error
Log::info("Job RecurringPayments Stripe Charge Error organization #{$organization->id} {$organization->name}:" . $e->getMessage());
$recurring->errors++;
$recurring->save();
// should create a new recItem instead of adding days to the current one
$recItem->scheduled_at = $now->addDays(2);
$recItem->save();

                if (!empty($membership->credit_card_error_template_id)) {
                    // should send it to org also
                    $this->sendEmail($membership->recipientList, $recipient, $invoice, $membership->credit_card_error_template_id, $sendOutRepository);
                }

                throw new GeneralException("Job RecurringPayments Stripe Charge Error organization #{$organization->id} {$organization->name} {$recItem->id}");
            }
#

I have something like this going on... but it doesnt trigger an erorr

#

and than throws an error here

#

protected function createPaymentFromStripeCharge(Organization $organization, Invoice $invoice, Recipient $recipient, $pi, $amount){
$payment = Payment::create([
'charge_id' => $pi->charges->data[0]->id,
'card_brand' => $pi->charges->data[0]->payment_method_details->card->brand,
'last4' => $pi->charges->data[0]->payment_method_details->card->last4,
'stripe_status' => $pi->status,
'paid_at' => now(),
'organization_id' => $organization->id,
'invoice_id' => $invoice->id,
'recipient_id' => $recipient->id,
'currency' => $organization->account->currency,
'type' => 'stripe',
'amount' => $amount,
'stripe_id' => $pi->id,
'receipt_no' => Payment::nextReceiptNo($organization),
'is_test_mode' => $organization->account->is_test_mode,
]);

    return $payment;
}
shut merlin
restive prairie
#

Is there a way to test it out somehow on local?

#

Like having a card that passes the first time but blocks on the second time via 3d stuff?

#

As I want to make sure my code handle it

shut merlin
restive prairie
#

Yes but it will work for the first attempt

#

But in a recurring context, it wont

#

As I need to capture the first payment

shut merlin
#

I am not clear on what you mean here. Test payments with that card will all succeed as long as you go through the test 3DS auth

#

So they will be held up by 3DS until that is completed.

#

Can you elaborate a bit on the test you are trying to do here?

restive prairie
#

I want the first attempt to succeed but when i try to charge it again

#

it will show 3ds auth

#

As i am working in a recurring payment envirormenet

shut merlin
#

That card will do that. The first payment will require 3Ds and then succeed, all subsequent recurring payments will also require 3DS

restive prairie
#

Great, will try that!

#

Also, if we attempted 3 times already, does it nofify her that we did or not at all?

#

As I dont want to charge her 3 times ๐Ÿ™‚

shut merlin
#

What was attempted 3 times already?

#

Are these three attempts to charge a real customer?

restive prairie
#

Yes, this code was in prod

#

And Im fixing it right now locally

#

๐Ÿ˜ฆ

#

amount_received of the PayementIntent object will be at 0 when Stripe wasnt able to fully procees?

shut merlin
#

Correct. They won't be charged until 3DS succeeds. And I don't think Stripe would notify this person but if there were three payments that required 3DS it is possible that their bank may notify them though I don't know if they would do that just for this.

#

So if you just forward them to a page to complete 3Ds for one of those payments they should be able to complete it

#

And you can cancel any other incomplete payment intents related to this

restive prairie
#

Yes i am planning to send them to an invoice page to pay