#akashpatil7596_code
1 messages ยท Page 1 of 1 (latest)
๐ 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/1380489856135987241
๐ 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.
- akashpatil7596_api, 1 hour ago, 23 messages
hi there!
Hello
I don't understand your question. the subscription you shared has expired.
you delete the subscription: req_tLI48mhGGbAGlz
can you share more details on what you are trying to do, what you expected to happen, and what is the issue?
Wait
sub_1RWxPLAGlCdR56ap9JvuchuR
In web I directly go to the page but in mobile app I redirected to webpage in browser and then done payment.
Why the payment isn't happening?
what do you mean "happening"?
means the invoice stays opens, it should be paid
why? did you retrive the client_secret of the first invoice, load it in the Payment Element, enter the payment details, and confirm the PaymentIntent?
Yes I Think so
creating the Subscription is just the first step. then you need to collect a payment method to actually pay te invoice.
How can I do that?
I Catch the invoice.created webhook, in that can I finalize and pay the invoice manually?
do you have a payment method for the customer?
Yes
OK, so the customer has a default payment method saved, and you expect that when you create a subscription, the default payment method gets automatically used to pay for the subscription?
Yes
having a look
It works fine in web but in mobile it creates a problem
can you share an example subscription ID where it worked as expected?
I'm confused about your payment flow.
can you explain in details what are all the steps you do after you create the Subscription? and what you expected to happen?
Ok wait
if (subscription.payment_type === PaymentTypeEnum.ONETIME) {
if (price > 0) {
const temp = await this.stripeService.createPaymentIntent({
customerId: stripeCustomerId,
price: price,
payment_method_id: paymentMethodId,
metadata: {
priceId: getProduct.default_price as string,
productName: subscription.title,
couponId: coupon ? coupon.id : null,
},
});
subscriptionEntitiesAttribute = {
end_date:
subscription.duration_unit === DurationUnitEnum.LIFETIME
? null
: add(new Date(), {
[subscription.duration_unit === DurationUnitEnum.MONTH ? 'months' : 'years']: subscription.duration,
}),
stripe_subscription_id: temp.id,
};
client_secret = temp?.client_secret;
} else {
subscriptionEntitiesAttribute = {
end_date:
subscription.duration_unit === DurationUnitEnum.LIFETIME
? null
: add(new Date(), {
[subscription.duration_unit === DurationUnitEnum.MONTH ? 'months' : 'years']: subscription.duration,
}),
subscription_status: SubscriptionStatusEnum.ACTIVE,
};
}
} else {
const temp: any = await this.stripeService.createSubscription({
customerId: stripeCustomerId,
priceId: getProduct.default_price as string,
coupon: coupon?.stripe_id,
});
const timeUnit = subscription.duration_unit === DurationUnitEnum.MONTH ? 'months' : 'years';
subscriptionEntitiesAttribute = {
end_date: add(new Date(), { [timeUnit]: subscription.duration }),
stripe_subscription_id: temp.id,
};
client_secret = temp?.latest_invoice.payment_intent?.client_secret;
}
Webhook:
try {
if (data?.type === 'invoice.created') {
const isSubscriptionExist = await this.subscriptionRepo.isSubscriptionExist(data, transaction);
if (isSubscriptionExist) {
const invoice = await this.stripeService.retrieveInvoice(data?.data?.object?.id);
if (invoice?.status === 'draft') {
await this.stripeService.finalizeInvoice(data?.data?.object?.id);
}
}
} else if (data?.type === 'invoice.payment_succeeded') {
await this.subscriptionRepo.recurringSubscriptionWebhookHandle(data, transaction);
} else if (data?.type === 'payment_intent.succeeded') {
const metadata = data.data.object.metadata;
if (metadata) {
if (metadata.type === 'giftCardPurchase') {
await this.giftCardRepository.handleGiftCardPayment(data, transaction);
} else if (metadata.type === 'Course') {
await this.coursePurchaseRepo.handleCoursePayment(data, transaction);
} else if (metadata.type === 'LiveAslAssessment') {
await this.liveAssessmentRepository.setLiveAssessment(data, transaction);
} else {
await this.subscriptionRepo.oneTimeSubscriptionWebhookHandle(data, transaction);
}
}
}
await transaction.commit();
} catch (error) {
await transaction.rollback();
logger.error('Error in stripeWebhookHandle' + JSON.stringify(error, undefined, 1));
}
I don't need your code. can you explain with words what you do and what you expect to happen?
I simply created a subscription on that I want to invoice get paid, but sometimes it went to open and I don't get confirmation on payment is successeded or not
like this one : sub_1RWxsmAGlCdR56apltoUSFwF
or maybe on buy the subscription I'm not getting the confirm API called from stripe side
๐ taking over for my colleague. Let me catch up.
yes sorry for taking too long
oh really? what's the issue?
In mobile on pay now I called my API to create the subscription but don't get the confirm API of stripe,
in web I get the confirm API, what is the confirm API?
I send you some images to look into
Did you get something?
sorry I'm still looking
for the mobile is it an app with a webview or are you testing it on a mobile browser?
In app I click on pay then it opens in web browser like chrome
you should use PaymentSheet in mobile apps
then you should use Checkout Sessions instead
we really don't recommend using stripe-js within an app webview
it doesn't work as expected
yes but right now this is the thing I have to work with, isn't that possible?
Checkout session is available for mobile app? I'm using flutter.
i mean you could open the checkout session outside of your app in the browser
can you just tell me what is this confirm API? how can i get it in app webview?
right now I have been told to do it like this, that's why
right now I have been told to do it like this, that's why
by whom?
?
it is the wrong method
and you should tell your seniors what I just told you above
we really don't recommend using stripe-js within an app webview
it doesn't work as expected
in all cases, I think there's already a community library https://pub.dev/packages/flutter_stripe that provides PaymentSheets for flutter
you can't use the same code for web and mobile unfortunately
Okay, this will take care of payment in-app, right?
yes
Hey
I reasearch about it, the play store and app store won't allow the methods other than in-app purchase.
@sinful mist
https://docs.stripe.com/mobile/digital-goods/checkout
We have implemented using this flow in order to verify our app through app and play store
If we use any built-in payment integration methods other than in-app purchase than there is a chance that our app may not get verified.
for subscriptions you mean?
I'm talking about in-general payment
for digital goods, it's only available on iOS
so you can link out to either a Checkout Session or to a Custom form using PaymentElement
for Android you need to use the native in-app purchases using Play Store
I need to do for both android and IOS I'm using flutter.
https://pub.dev/packages/flutter_stripe
This you provided I don't think app-play store will allow it.
if it's for digital goods then yes
Yes, out app is for digital goods so can we use the current flow for payments ? and I am still unsure weather I can use it for android and ios both ?