#massimo-ionic

1 messages · Page 1 of 1 (latest)

wooden burrow
#

hi! what's the PaymentIntent ID pi_xxxx ?

uncut mural
#

pi_3LHmDMBIRCPS7xyy07NciyyT

wooden burrow
#

that payment just didn't require 3D Secure, so there was no next_action.

#

you created it on your backend server and it was immediately returned status: "succeeded" which means the payment succeeded and there was no need to do 3D Secure on it, that's normal and can happen.

uncut mural
#

ok, but this happen every payment?

wooden burrow
uncut mural
#

I've already did it and it allways pay without 3d secure form. I've tested live with 2 different credit cards and no confirmation needed (that usually ask the 3d secure confirmation). In my dashboard, I've this message:
"No payment used an SCA compliant product"
is it correct?

wooden burrow
#

you're not supposed to test in live mode

#

I'm not familiar with the message you're describing but if you use PaymentIntents, those are SCA-compliant.

#

can you share the code you use to parse the next_action by the way?

#

I assume you are doing it wrong, and you look for a URL inside next_action.use_stripe_sdk

#

that's incorrect, if you're handling the redirect yourself instead of using our SDK(because you use Ionic where we don't have an official SDK), you need to pass a return_url to the PaymentIntent and use the next_action.redirect_to_url , per the documentation at https://stripe.com/docs/payments/3d-secure#manual-redirect

uncut mural
#

I can't use next_action because is null in live mode

wooden burrow
#

hm, I don't understand

#

you write the code and test it in test mode and that's how you confirm that your code does what's expected

#

not every payment in livemode is going to require 3D Secure, that's normal, so you need to handle both cases(not required — you can use the test card 4242424242424242 for that to confirm your code handles it; and required — you can use the test card 4000000000003220 for that to confirm your code handles it)

uncut mural
#

in test mode I've used the 4242424242424242, 4000002500003155 and 4000000000003220 cards and no next_action returned. here are the code in the app:

this.stripe.createPaymentMethod({
type: 'card',
card: this.cardNumberElement
}).then((res:any) => {
console.log("RES ",res);
this.validateCardDentro(res);
});

vaildateCardDentro call the API in server and the code is:

#

try {
// Use Stripe's library to make requests...

    $stripe = new \Stripe\StripeClient($stripe['secret_key'], ['stripeAccount' => 'acct_1LDSgTBIRCPS7xyy']);

    $paymentIntentCreate = $stripe->paymentIntents->create([
        'amount' => $postjson['totale']*100,
        'currency' => 'eur',
        'payment_method_types' => ['card'],
        'payment_method' => $postjson['paymentMethod']['id'],
        'description' => 'Biglietto SpazioSport Lido - '.$postjson['nome'].' - '.$postjson['email'],
        'confirmation_method' => 'automatic',
        'confirm' => true
    ]);

    $data = $paymentIntentCreate; //.' *** '.$account;
} catch(\Stripe\Exception\CardException $e) {
    // Since it's a decline, \Stripe\Exception\CardException will be caught
    $data = 'Status is:' . $e->getHttpStatus() . '\n
    Type is:' . $e->getError()->type . '\n
    Code is:' . $e->getError()->code . '\n
    
    Param is:' . $e->getError()->param . '\n
    Message is:' . $e->getError()->message . '\n';
} catch (\Stripe\Exception\RateLimitException $e) {
    // Too many requests made to the API too quickly
    $data = "TOOMANYREQUESTS ";
    $result=json_encode(array('success'=>false, 'result'=>$data));
} catch (\Stripe\Exception\InvalidRequestException $e) {
    // Invalid parameters were supplied to Stripe's API
    $data = "INVALIDPARAMETERS";
    $result=json_encode(array('success'=>false, 'result'=>$data));
} catch (\Stripe\Exception\AuthenticationException $e) {
    // Authentication with Stripe's API failed
    // (maybe you changed API keys recently)
    $data = "AUTHENTICATIONFAILED ";
    $result=json_encode(array('success'=>false, 'result'=>$data));
} catch (\Stripe\Exception\ApiConnectionException $e) {
wooden burrow
#

it would definitely return a next_action when using 4000002500003155 and 4000000000003220

#

any example PaymentIntents pi_xxx you can share where that didn't happen?

uncut mural
#

this is the object returned using 4000002500003155:

#

{
"paymentMethod": {
"id": "pm_1LHqRRBIRCPS7xyyF1EvdeAQ",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": null
},
"country": "FR",
"exp_month": 12,
"exp_year": 2025,
"funding": "credit",
"generated_from": null,
"last4": "3155",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1656945601,
"customer": null,
"livemode": false,
"type": "card"
}
}

wooden burrow
#

that's a PaymentMethod

#

not a PaymentIntent

uncut mural
#

ok thanks