#MICOZ-subscription attempts
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
what is the collection_method on this subscription? send_invoice or charge_automatically?
automatically
in that case you'd have to generate a Customer Portal (https://stripe.com/docs/api/customer_portal/sessions/create) for your customer and ask them to go to that link and change their billing method etc...
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
let me know if you need any more help
@pliant carbon what's up?
hi
I have created a customer portal, everything works except that when the billing data is entered it attaches them to the customer and not to the card
so in my server I would have to make one more request to get the billing data and the last 4 letters of the default payment method
I see, and is that a blocking problem?
it is not a problem but now if I have to request billing information I have to retrieve the customer and then the payment method to get his last 4 letters of the card
you can't really control the API calls the customer portal makes and how the information in the API ends up being laid out. If you could be more specific about what information you're looking for in which specific API fields and how you approach it today I could try to let you know if there is a more efficient way but there might not be
I see, and why is that a problem exactly? I don't really follow.
i try to explain better
I need to show the user's billing information and the last 4 letters of the card on my site.
before I didn't use the client portal and I personally managed the various apis to do it,
for reasons of convenience and additional functionality I have decided to integrate the customer portal.
doing various tests I saw that when I update the billing data with the portal, your system enters them as information in the customer but not in the user's card
before to have all the data (billing and last4 letters) I used this api that gave them all together
const paymentMethods = await stripe.customers.listPaymentMethods(id, { type: 'card' })
return {
last4: customerInfo.card.last4,
name: customerInfo.billing_details.name,
country: customerInfo.card.country,
address: customerInfo.billing_details.address.line1,
city: customerInfo.billing_details.address.city,
postcode: customerInfo.billing_details.address.postal_code,
phone: customerInfo.billing_details.phone
}
so now i should make an extra request to get the billing data because they are saved in the customer now
I would have preferred to do just one api as before to decrease the load on the server and increase the speed
your system enters them as information in the customer but not in the user's card
can you clarify where on the customer it enters them? What API field are you seeing the information contained in?
are you saying it saves the address to customer.address for example? (instead of on the PaymentMethod billing_details as you want?)
exactly
if that's how it works it's just how it works I'm afraid, there's nothing you can really do about it or avoid the extra call
the solution could be that when you add a new card you also ask for the billing information along with it
no problem sir
custmer.address is meant for the customer's overall top-level address, but a customer might have different cards with different billing addresses. I'd assume the UI for the portal makes some distinction there , not really familiar with it. But that's why there are two different places in the API for this information
true, I will do one more request to get the information of the default payment method
last thing
mainly I wanted to add the portal for this reason.
#dev-help message
so if the user enters in this phase and wants to renew immediately after the first debit failure, will a screen appear on the subscription as shown in the picture?
because at the moment in the customer portal I only see my subscriptions (I am not in this case at the moment (charges attempt))
I therefore assume that the customer will see something to renew immediately if the first attempt at auto-renewal has failed
they can see all their open Invoices and visit a page to try to pay those invoices(including entering new payment information)
I think listing Charges on the PaymentIntent associated with the Invoice can work : https://stripe.com/docs/api/charges/list?lang=ruby#list_charges-payment_intent
ok perfect
thanks a lot guys
one last thing and no longer bother you promised ahaha
if i want to migrate a subscription from one user to another what can i do?
you'd create a new subscription for the other customer, and cancel the existing subscription on the old one, there's not really any inbuilt support for a direct migration
you'd generally also use approaches like https://stripe.com/docs/billing/subscriptions/billing-cycle#new-subscriptions to align the cycle of the new subscription to the old one, depends what exactly you're aiming for.