#rohith_code

1 messages ยท Page 1 of 1 (latest)

peak plazaBOT
#

๐Ÿ‘‹ 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/1372936796266299453

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

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

fervent wagon
#

hi there, what are you expective to happen here and what are you observing?

#

Can you share the customer ID you're retrieving?

peak plazaBOT
lunar anchor
#

hi i'm trying to retrieve user card last 4 digits shown similarly in below url

#

cus_SK1R9hvZi7w8jV

true coyote
#

Hey there

#

That is the default PaymentMethod on the Subscription

lunar anchor
#

yes sir

#

even using one in subscription im not able to fetch

true coyote
#

Are you expanding?

lunar anchor
#

i'm getting stripe callback event of invoice failed
in that i get invoice object

true coyote
#

Ah you want to go from the Invoice to the PaymentMethod

lunar anchor
#

when i fetch subscription im getting above json

true coyote
#

Yep that's because you aren't expanding default_payment_method

lunar anchor
#

var service = new SubscriptionService();
var options = new SubscriptionListOptions()
{
Customer = customerId,
Limit = 1,
};
var subscriptionsList = await service.ListAsync(options);
if (!subscriptionsList.Any())
{
return null;
}

    return subscriptionsList.First();
true coyote
#

You need to add Expand = new List<string> { "data.default_payment_method" },

lunar anchor
#

thank you so much

true coyote
#

Sure thing

lunar anchor
#

i need one more help please

true coyote
#

Sure what's up

lunar anchor
#

i have a similar scenario where my upgrade fails due to 3d secure confirm is required , as part of that i'm receiveing a invoice hosted url which has option to confirm payment

#

instead of sending that to customer i want to create a url similar to check out session url , using which user can make payment against this invoice and redirect to my website

true coyote
#

Okay so you want to create your own payment form on your own website to have your user pay for the Invoice on your website, correct?

lunar anchor
#

yeah tecnically at backend i will generate url and pass it to website, which will redirect to stripe checkout page and post payment user is redirected to my website

true coyote
#

So you can't use Stripe Checkout here and tie the Invoice to the Subscription.

#

Stripe Checkout is only used for creating a new Subscription or taking a one-off payment not associated to an Invoice.

#

You would need to create a custom integration using Payment Element if you want to pay the Invoice on your own site.

lunar anchor
#

so how can i acheive what i'm loking for

true coyote
#

The only other option is to have them pay via Stripe Checkout and then you can mark the Invoice as paid.

lunar anchor
#

can you please give sample for stripe check out

true coyote
lunar anchor
#

exactly, but i could not get payment intent when i fetched invoice details

true coyote
lunar anchor
#

i am getting that as null

true coyote
#

Are you expanding?

#

Since it is a nullable dictionary it will be null unless expanded.

lunar anchor
#

var invoiceService = new InvoiceService(_stripeClient);
await Task.Delay(2000);
var invoice = await invoiceService.GetAsync(updatedSubscription.LatestInvoiceId);

true coyote
#

You need to expand latest_invoice.confirmation_secret

#

Err wait sorry you are retrieving the Invoice here

#

So you just expand confirmation_secret

lunar anchor
#

can you pease point out to sample ccode

true coyote
#

Or if you are going from the Subscription you would do latest_invoice.confirmation_secret

#
 var subscriptionOptions = new SubscriptionCreateOptions
   ...
    subscriptionOptions.AddExpand("latest_invoice.confirmation_secret");
lunar anchor
#

oh cool i can do from subscription too

true coyote
#

Yeah

lunar anchor
#

thank you so much for your inputs, you saved my day ๐Ÿ™‚

#

Thank you for crisp support