#rups
1 messages · Page 1 of 1 (latest)
👋 How can I help?
hi what is your good name?
I'm River. This channel is for Stripe technical integration questions. Is there anything that I can help?
yes please I am struglling changing integration for 3d secure.
my requirement is to create trial subscription for 30 days and after 30 days 20pound will charge.
can you please guide be step by step.
as currently integration shows that I subscribe successfully with trial period
but im unsure that amound also deducted.
there?
just a minute
sub_1NJI19KEj4mhMNmpqiabKk67
trial subscription created successfullly.
?
Since the subscription is in trial, there is no amount to be deducted: https://dashboard.stripe.com/subscriptions/sub_1NJI19KEj4mhMNmpqiabKk67 (See $0 invoice)
Customer will only be charged after the trial ends
ok that is clear from subscription page
in overview
below "Subscription"
"Payments"
it says
20 pound | PaymentIntent Created | date |
on this last 3 dots click
there is option for refund payment
does not it mean this amount is deducted from customer account?
it seems like my integration issue..
amount also deducted in trial subscription
The payment intent is irrelevant to the subscription. It was another request that your system made to make a separate payment: https://dashboard.stripe.com/logs/req_hPK41e9NHVWEyi
It was another request that your system made to make a separate payment:
=> so you mean to say that it is wrongly implemented?
You have a subscription and one-time payment on this customer
I'd recommend checking which part of your code triggered one-time payment
If you only wishes to charge the customer through subscription, you shouldn't create a separate payment intent
ok got it
`$paymentIntent = \Stripe\PaymentIntent::create([
'amount' => $amount*100,
'currency' => 'gbp',
'description' => 'PaymentIntent Created',
'payment_method_types' => [
'card'
]
]);
$data['output'] = [
'stripePlanId' => $stripePlanId,
'id' => $paymentIntent->id,
'clientSecret' => $paymentIntent->client_secret
];`
Why do you create the payment intent for a subscription?
I am passing this "clientsecret" to confirmcardpayment.
await stripe.confirmCardPayment(clientsecret, { payment_method: { card: cardElement, billing_details: { name: customer_name, }, }, return_url: "<?php echo base_url('paymentreturn.html'); ?>" }).
to enable 3d secure
For a subscription, you don't need to create a payment intent
but once trail end I have to charge customer
I'd recommend following this guide to create the subscription: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
If the subscription has a trial, you can expand pending_setup_intent as pending_setup_intent will be created which you can use its client secret to pass the client to complete the payment method collection with 3DS
can you plass code for the same.
PHP with javascript / jquery?
as i am trying since 15 days and couldnt make it work perfectlly
I'm afraid we don't have the full doc for this. The steps are:
- Follow the doc: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
- At step 5 of the doc, expand
pending_setup_intentas well, i.e.'expand' => ['latest_invoice.payment_intent', 'pending_setup_intent'], - At step 6 of the doc, if the client secret is for Setup Intent (seti_xxx_secret_xxx), then
stripe.confirmSetup()should be used instead of usingstripe.confirmPayment: https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements#submit-payment-details
Yes there is no document with code.
At step 5 of the doc, expand pending_setup_intent as well, i.e. 'expand' => ['latest_invoice.payment_intent', 'pending_setup_intent'],
=> how to achive this via code level?
you mean to say I have create subscription with expand as above?
When you create a subscription, you will expand pending_setup_intent field as well, so that you can retrieve Setup Intent's client secret and send it to client to render Payment Element. For example,
$subscription = $stripe->subscriptions->create([
'customer' => $customer_id,
'items' => [[
'price' => $price_id,
]],
'payment_behavior' => 'default_incomplete',
'payment_settings' => ['save_default_payment_method' => 'on_subscription'],
'expand' => ['latest_invoice.payment_intent', 'pending_setup_intent'],
]);
yes that I did and got client_secret too.
`$subscribe = \Stripe\Subscription::create([
'customer' => $user['stripeCustomerId'],
"items" => [
[
"plan" => $stripePlanId,
],
],
'payment_behavior' => 'default_incomplete',
'expand' => ['latest_invoice.payment_intent', 'pending_setup_intent'],
]);
$data['output'] = [
'stripePlanId' => $stripePlanId,
// 'id' => $paymentIntent->id,
'clientSecret' => $subscribe->latest_invoice->payment_intent->client_secret
];`
Uncaught (in promise) IntegrationError: Your code called confirmSetup() but you passed a client_secret associated with a PaymentIntent. Did you mean to call confirmPayment() instead?
now getting this
For non-zero invoice (without trial), you will get Payment Intent client secret from latest_invoice->payment_intent->client_secret
For zero invoice (with trial), you will get Setup Intent client secret from pending_setup_intent->client_secret
on frontside
' const {error1} = await stripe.confirmSetup({
//Elements instance that was used to create the Payment Element
elements,
confirmParams: {
return_url: 'https://example.com/order/123/complete',
},
});
'
Is the subscription you created with trial?
- For non-zero invoice (without trial), you will get Payment Intent client secret from
latest_invoice->payment_intent->client_secret-> Usestripe.confirmPayment() - For zero invoice (with trial), you will get Setup Intent client secret from
pending_setup_intent->client_secret-> Usestripe.confirmSetup()
$subscribe = \Stripe\Subscription::create([ 'customer' => $user['stripeCustomerId'], "items" => [ [ "plan" => $stripePlanId, ], ], 'payment_behavior' => 'default_incomplete', 'expand' => ['latest_invoice.payment_intent', 'pending_setup_intent'], 'payment_settings' => ['save_default_payment_method' => 'on_subscription'], 'trial_end' => 30, ]);
free trial
and I got client secret
$data['output'] = [ 'clientSecret' => $subscribe->latest_invoice->payment_intent->client_secret ];
Can you share the request ID (req_xxx) which you created the subscription? Here’s how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
In https://dashboard.stripe.com/test/logs/req_aDj70JHn3aJ9K3, I don't see you setting the trial
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
'trial_end' => $trialEnd, ? is it right way?
You can use either trial_end or trial_period_days: https://stripe.com/docs/billing/subscriptions/trials
currected.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
check now.
Yup, this is correct. So you need to get the Setup Intent client secret from pending_setup_intent->client_secret and pass to your client
nd pass to your client? perticular which method?
const {error1} = await stripe.confirmSetup({
//Elements instance that was used to create the Payment Element
elements,
confirmParams: {
return_url: 'https://example.com/order/123/complete',
},
});
You will return Setup Intent client secret to the frontend and follow the Step 5 from this doc onwards: https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements&client=html#collect-payment-details
it didnt prompt 3d secure popup
const {error1} = await stripe.confirmSetup({ //Elementsinstance that was used to create the Payment Element elements, confirmParams: { return_url: 'https://example.com/order/123/complete', }, });
Are you using 3DS test cards? https://stripe.com/docs/testing#regulatory-cards
yes
Can you share the subscription ID (sub_xxx)?
sub_1NJXA7KEj4mhMNmp8QIVqXmx
In the setup intent seti_1NJXA7KEj4mhMNmpQ9RWPyV6 of sub_1NJXA7KEj4mhMNmp8QIVqXmx, I can see that 3DS has been completed
yes
Didnt you see a pop up window to confirm 3DS authentication?
https://stripe.com/docs/payments/3d-secure#three-ds-cards before that I was using this
4000000000003063
so it didnt ask for 3d popup. in above card.
3DS was completed from what I saw in seti_1NJXA7KEj4mhMNmpQ9RWPyV6
Could you share your development website, so that I can have a closer look?
From my logs, I do see 3DS performed, i.e. 3DS window has popped up and completed
I'd need your development website that's accessible for me to check why it wasn't the case
what is next
ohh
im discussiong with rive since long
create trial subscription without initially payment charge.
Yes, but what's your question? What do you mean by "what is next"?
Yes I understand this part. But what's your question?
What does "not working as expected" mean? What is happening exactly?
And can you share a subscription ID (sub_xxx)?
'await stripe.confirmSetup({
//Elements instance that was used to create the Payment Element
elements,
confirmParams: {
return_url: "<?php echo base_url('payment'); ?>"
},
})`
here what will be return url
And... what is the problem/question?
The return URL is something you set yourself, and users will be redirected there after the payment is successful
but before redirect customer I need to submit form on db level
What "form" are you talking about? What exactly do you want to save in your database?
https://pehoy.com/steviewebsite-php
click on "Join Stevie" button
register user
once register it will ask you for payment
I don't want to create an account on your website, I'm just trying to understand what is your issue exactly.
Usually you have a form with the customer information: you save that in your own database, and is unrelated to Stripe.
Then for the payment, you confirm the PaymentIntent, then the user is automatically redirected to the return_url, and then you can use a webhook endpoint to store the payment information.
wait
above url is just development server.
you can create user there
have you checked?
Hi! I'm taking over from my colleague. Please, give me a moment to catch up.
Could you please summarise the latest question?
ok
We can't register on your website, so please try to explain/show the situation.
ok
requirement:
subcription create with 30 days
as suggested by river I did this in PHP
$subscribe = \Stripe\Subscription::create([
'customer' => $user['stripeCustomerId'],
"items" => [
[
"plan" => $stripePlanId,
],
],
'payment_behavior' => 'default_incomplete',
'expand' => ['latest_invoice.payment_intent', 'pending_setup_intent'],
'payment_settings' => ['save_default_payment_method' => 'on_subscription'],
'trial_period_days' => 30,
]);
I got client secrete here
'clientSecret' => $subscribe->pending_setup_intent->client_secret
than this secret I am passing to client side
async function handleSubmit(e) {
showMessage('');
showLoadingBar();
event.preventDefault();
console.log(clientSecret);
await stripe.confirmSetup({
//`Elements` instance that was used to create the Payment Element
elements,
confirmParams: {
return_url: "<?php echo base_url('payment'); ?>"
},
});
are you getting?
So what's the exact problem?
now after click on submit button > my page is redirect to above return url.
wih get method
here I stuck now.
if I manually back from browser than subscription created with trial and no amount deducted.
but how to handle redirect things here.
is it compusory to redirect?
The subscription is created anyway, because it's in trial, however it will cancel in the end of trial if no payment method will be added.
Is this an issue?
What do you mean by "but how to handle redirect things here."?
Are you asking about fulfilling orders when the customer has successfully paid?
lets start from scratch.
for trail subscription without payment.
1st Step:
Create Subcription with trail period defult incomplete
` $subscribe = \Stripe\Subscription::create([
'customer' => $user['stripeCustomerId'],
"items" => [
[
"plan" => $stripePlanId,
],
],
'payment_behavior' => 'default_incomplete',
'expand' => ['latest_invoice.payment_intent', 'pending_setup_intent'],
'payment_settings' => ['save_default_payment_method' => 'on_subscription'],
'trial_period_days' => 30,
]);`
Can you please verify this? so that I move further
There?
Sorry for delay, it's busy.
I can't review all of your code, unfortunately. Please let me know if you see any specific errors and we will solve it together.
I am explaining error when we start discussiong
still you are not clear so I started from scratch
You sent me the same code as before.
Could you please share the exact error/problem you're seeing and I will be happy to look into it.
I understand your situation by now, but I don't see any issue.
sub_1NJZbjKEj4mhMNmp0Ei6JZeV
can you check this?
after subscrtiption create with trial of 30 days and successfully attempted 3d secure
it gets cancel automatically
It doesn't get cancelled automatially, you cancel it manually from the Dashboard: https://dashboard.stripe.com/test/logs/req_C0Kjg0yxRw2d4Y
ok