#rpanda624-3ds-failed

1 messages · Page 1 of 1 (latest)

slim trellis
#

Hey. Which test card data were you using when 3DS failed?

#

Can you share the ID of a failed Payment Intent

quasi canyon
#

yes

#

i just copied the code

#

When i applied in my folder

#

it is faied due to 3d authntication failed

#

this is working well

#

Are u still with me?

slim trellis
#

That link isn't really much help here I'm afraid. I've no idea who wrote that or what the source code is doing!

#

Can you share the ID of a failed Payment Intent?

#

You can find this from your Stripe Dashboard

quasi canyon
#

ok

#

pi_1KTPkML0UCk6PI8A7gmsoGPK

#

Are u still with me

#

?

slim trellis
#

Yep, please bear with me

quasi canyon
#

Are u checking?

slim trellis
#

I am

#

The bank/card issuer requested an 3DS/auth check in this instance. This is reflected on the PI status: requires_action

#

Ah, you're an Indian merchant. Will be probably be because of RBI regulations: https://support.stripe.com/questions/rbi-regulations-affecting-payments-from-india-issued-cards

#

Which requires auth for all payments

#

You'll need to handle this accordingly using Stripe.js

quasi canyon
#

I have stripe.js

#

but why it is not redirecting

slim trellis
#

Well you'd need to share your code for me to be able to answer that!

#

How are you returning the Payment Intent to your client application?

quasi canyon
#

Well you'd need to share your code for me to be able to answer that!
Thanks

#

i am giving you a file

#

can you check plz

slim trellis
#

I can't download that I'm afraid. You can just paste the relevant code into this chat

quasi canyon
#

<?php
// Subscription plans
// Minimum amount is $0.50 US
// Interval day, week, month or year
$plans = array(
'1' => array(
'name' => 'Weekly Subscription',
'price' => 1,
'interval' => 'week'
),
'2' => array(
'name' => 'Monthly Subscription',
'price' => 1,
'interval' => 'month'
),
'3' => array(
'name' => 'Yearly Subscription',
'price' => 950,
'interval' => 'year'
)
);
$currency = "USD";

/* Stripe API configuration

  • Remember to switch to your live publishable and secret key in production!
  • See your keys here: https://dashboard.stripe.com/account/apikeys
    */
    define('STRIPE_API_KEY', 'sk_test_Eq65nS4rqhsxG5rAA9KcPDMy00ZbyAYJqP');
    define('STRIPE_PUBLISHABLE_KEY', 'pk_test_LPuAjxWw5zDIQI8x3T9iZoTp00guT10hhu');

?>

#

View Page

#

Only problem is 3d authnticate failed

slim trellis
#

Yeah your integration is very dated. It's using older APIs (tokens) and doesn't factor in 3DS auth

quasi canyon
#

If i download it, will it work?

#

it is fixed price

#

i want to pass dynamic price

slim trellis
#

What's a dynamic price?

quasi canyon
#

suppose one customer put price , this price will automatically going to stripe checkout page

slim trellis
#

Then you'd need to build the UI to enable that selection yourself. But that's no different to a 'fixed price' subscription

quasi canyon
#

let me check

#

can u tell me plz

#

i want to show one text box and fill the amount

#

it will redirct to stripe checkout page

slim trellis
quasi canyon
#

I tried it

#

it is not working

#

Can you help me plz?

#

This code is not correct

slim trellis
#

I can help you with a specific question/issue, yes. Is there an error?

quasi canyon
#

<form action="/create-checkout-session" method="POST">
<!-- Add a hidden field with the lookup_key of your Price -->
<input type="hidden" name="lookup_key" value="pricedynamically" />
<button id="checkout-and-portal-button" type="submit">Checkout</button>
</form>

#

<form action="/create-checkout-session" method="POST">

#

Where it get create-checkout-session

#

page

#

ynnoj
Did you understand
What i am saying?

#

Are u there?

slim trellis
#

Where it get create-checkout-session
That's outlined at the link I shared. You'd create a backend function to handle the Checkout Session creation

quasi canyon
#

I need code but

#

it should be simple code

#
  1. One text box
    then enter amount
    then redirect to stripe checkout page
slim trellis
#

We don't write code/integrations for users here

#

I can help with specific issues, but we don't write the code

quasi canyon
#

Ok i understand

#

but can you tell me what is the exact issue

#

const STRIPE_PUBLISHIABLE_KEY = "pk_test_LPuAjxWw5zDIQI8x3T9iZoTp00guT10hhu";

const STRIPE_SECRET_KEY = "sk_test_Eq65nS4rqhsxG5rAA9KcPDMy00ZbyAYJqP";

const SUBSCRIPTION_PLAN_ID = "";

const PRODUCT_NAME = 'PHP Video Tutorials with eBook';

const PRODUCT_TYPE = 'service';
#

What i put in the SUBSCRIPTION_PLAN_ID

slim trellis
#

I'm not sure what this is referencing here, but I guess it would be the ID of a Price object

quasi canyon
#

I did not understand

#

How do i pass const SUBSCRIPTION_PLAN_ID = "";

slim trellis
#

Pass it where?

quasi canyon
#

lib/Config.php

#

<?php
namespace Phppot;

class Config
{
const STRIPE_PUBLISHIABLE_KEY = "pk_test_LPuAjxWw5zDIQI8x3T9iZoTp00guT10hhu";

const STRIPE_SECRET_KEY = "sk_test_Eq65nS4rqhsxG5rAA9KcPDMy00ZbyAYJqP";

const SUBSCRIPTION_PLAN_ID = "";

const PRODUCT_NAME = 'PHP Video Tutorials with eBook';

const PRODUCT_TYPE = 'service';

}
?>

#

Sir
Are u still connect with me?

slim trellis
#

You would use that price_xxx ID when creating the Subscription/Checkout Session

quasi canyon
#

Ok

#

but how to pass this id in const SUBSCRIPTION_PLAN_ID = "";

#

Do you have any idea

keen nebula
#

what do you mean by 'how to pass'?

quasi canyon
#

price_xxx ID - how do i pass this id in const SUBSCRIPTION_PLAN_ID = "";

keen nebula
#

you enter it. const SUBSCRIPTION_PLAN_ID = "price_xxx";

#

it works (Prices work in any API that requires a Plan, it's forwards compatible.

quasi canyon
#

i know SUBSCRIPTION_PLAN_ID = "price_xxx";

#

but price id is dynamic accroding the price

#

tell me plz what is the variable i will use

Just like
const STRIPE_PUBLISHIABLE_KEY = "pk_test_LPuAjxWw5zDIQI8x3T9iZoTp00guT10hhu";

const STRIPE_SECRET_KEY = "sk_test_Eq65nS4rqhsxG5rAA9KcPDMy00ZbyAYJqP";
keen nebula
#

that question doesn't make sense I'm afraid.

#

this file is for static configuration of static things. If the price is dynamic you wouldn't use a static Price ID in a config file, you'd write some specific custom code instead.

quasi canyon
#

i dont want to pass static price

#

i want to pass dynamic price

#

how?

keen nebula
#

you'd write code to create a Price for the amount you want at the time of the customer creating the subscription.

#

you kind of already have that in some of the code you shared above where you called \Stripe\Plan::create before creating a subscription. Same idea.

quasi canyon
#

ok

#

price_id is creating

#

but it is not passed

keen nebula
#

what does that mean?

quasi canyon
#

public function createPlan()
{
$plan = \Stripe\Plan::create([
'amount' => 2000,
'currency' => 'usd',
'interval' => 'month',
'product' => ['name' => Config::PRODUCT_NAME],
]);
return $plan;
}

#

$planId is creating but it is not redirecting to stripe checkout page

keen nebula
#

what does "not redirecting" mean? that code you posted doesn't directly do a redirect.

quasi canyon
#

redirect means

stripe checkout page

#

<script>
var stripe = Stripe('<?php echo Config::STRIPE_PUBLISHIABLE_KEY; ?>');
//Setup event handler to create a Checkout Session when button is clicked
document.getElementById("subscribe").addEventListener("click", function(evt) {
createCheckoutSession('<?php echo Config::SUBSCRIPTION_PLAN_ID; ?>').then(function(data) {
// Call Stripe.js method to redirect to the new Checkout page
stripe.redirectToCheckout({
sessionId: data.id
}).then(handleResult);
});
});
</script>

#

it is not SUBSCRIPTION_PLAN_ID

keen nebula
#

indeed.

quasi canyon
#

Thats why it is not redirectinbg stripe checkout page

keen nebula
#

I agree!

#

then maybe change the code? I don't know where you call that createPlan() function from. But I would probably

  • change the signature of the frontend createCheckoutSession function to not take an ID and remove the reference to the Config class
  • on the backend, change the logic so that when that endpoint is called, you call createPlan(), take the ID returned, and then call into your createCheckoutSession PHP function with it.
quasi canyon
#

can you tell me without craeting product using api , can i create plan_id

#

using price

keen nebula
#

you always need a Product(and then a Price or a Plan). The Product is required.

quasi canyon
#

but when i click on this link and submit the button

#

it is automatocally created product

#

repeatly

keen nebula
#

yes, it does (that's what happens when using product => [...] in the \Stripe\Plan::create function to pass Product details ad-hoc), it creates a "backfilled" Product archived object. Shouldn't be a problem. Did you have a question?