#rangermillze_api

1 messages ยท Page 1 of 1 (latest)

fickle stoneBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1303237996820041728

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

pliant kraken
#

hello! If i undertand the question correctly, you're asking how to handle the situation where 3DS is required for payment? You should use confirmPayment on your frontend : https://docs.stripe.com/js/payment_intents/confirm_payment.

There's an example here : https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=web&ui=elements#complete-payment that might be helpful

Create and manage subscriptions to accept recurring payments.

runic scroll
#

Hi, not really. We have already handled the payment with 3dsecure and the customer already has a subscription. Its when the customer adds an additional item to an active subscription that was paid for using 3dsecure. Non 3dsecure customers who add items are charged automatically without the need to go through the payment process.

pliant kraken
#

you want the customer to go through 3DS when a subscription update requires payment?

fickle stoneBOT
runic scroll
#

yes, we add the item fine using php and the response from our ajax call checks for the response. If the response is paid which we get from ( $itempaid = $response->latest_invoice->paid; ) with normal cards then we just show a message to the user. If the payment requires authenticating then we need to fine a way to determine how to show the popup authentication. I notice our payment call response has "status": "requires_action". if we capture this then send it back to our js code then can we issue a call to popup the 3dsecure window?

tranquil spear
#

Hi @runic scroll yes you are right, if the payment intent status is requires_action, it means this transaction requires 3DS authentication.

runic scroll
#

hi, when we try and show th epayment element we get: Uncaught IntegrationError: Missing value for Stripe(): apiKey should be a string.

tranquil spear
#

Can you show me your code?

runic scroll
#

sure

#

and on our gateway_init:

#

if( $upgrade_subscription == "pro" ){
//add a new item to an existing subscription
$response = $stripe->subscriptions->update(
$order['current_subscription_id'],
[
'items' => [
[
'price' => $product_price_id,
'quantity' => 1,
],
],
'proration_behavior' => 'always_invoice',
'expand' => ['latest_invoice.payment_intent']
]
);
$status['hosted_invoice_url'] = $response->latest_invoice->hosted_invoice_url;
$status['paid_status'] = $response->latest_invoice->paid;
$status['invoice_id'] = $response->latest_invoice->id;
if($status['paid_status'] == 1){
$status['update_video_access'] = updateDB("UPDATE htsc_users SET user_videoaccess = 1 WHERE user_id = " . $order['user_id'] );
//add invoice
$logdata = "UPGRADE SUBSCRIPTION TO PRO: success\r\n";
$logdata .= "ACTION: update_video_access: " . $status['update_video_access'] . "\r\n";
$logdata .= "INFO: INVOICE ID: " . $status['invoice_id'] . "\r\n";
}
UpdateLogFile($logfile, $logdata, "stripe");
die( json_encode($status, true) );
}

tranquil spear
#

Do a console,log and make sure stripePublicKey is a valid publishable key

runic scroll
#

I think i see where we are oging wrong. we exit the gateway_init premeturely for 3dsecure.

#

the stripePublicKey isnt being added to the response. thanks!

#

hi, if we leave it as it is without taking immediate payment then at the end of the next cycle will the payment be automatically taken? because I can see on our stripe dashboard: Upcoming invoice
This is a preview of the invoice that will be billed on Nov 4, 2025. It may change if the subscription is updated.

#

the payment for the video license (the addon) is added.

tranquil spear
#

You mean will Stripe automatically pay the next invoice if the first invoice wasn't paid?

runic scroll
#

yes, if we just enable the addon would stripe automatically take the payment as it says?

tranquil spear
#

No the subscription will expire if its first invoice isn't paid within 23 hours

runic scroll
#

the first invoice was paid for already - this is just an addon )an extra item) added to the subscription

#

process was client created and paid for a subscription, then mid way month decides to add a new feature/addon.

#

this is what the issue is, with normal card payments thepayment is teken automatically but when using 3ds $response->latest_invoice->paid = false and $response->latest_invoice->status = requires_action

tranquil spear
#

I see

#

Is the collection_method send_invoice or charge_automatically ?

runic scroll
#

charge_automatically

tranquil spear
#

Ok in that case Stripe will try to pay the next invoice. You should test this flow out by using test clock