-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[iOS] Paymentsheet not showing available payment methods #313
Comments
I'm seeing this issue too. |
@rdlabo availability of PayPal payment option is a core feature for this plugin, on iOS as well. The users of this plugin would be very thankful if you could share any insights on what we could expect from this plugin concerning PayPal on iOS. I am personally motivated to contribute improvements on this matter, however we do need some guidance from you on what you suggest to do here. |
This is what I found out so far: To show all available payment methods on iOS it is required to initialize the
This makes sense, because stripe will redirect to external pages (PayPal.com, etc.) to fulfil payment and of cause needs to jump back somehow, when payment went through. iOS or stripe seems to be here very strict and evaluates the url immediately after assignment (surprisingly not so on Android). If But for iOS a valid Url means a Url with a “Custom URI Scheme”: See here for more details: At the end of the day, you need add an entry into Info.plist like this:
If you now assign “my-app://home/shop/payment-result” to Of cause Btw, on redirect stripe adds a whole bunch of parameters as a query string that gives you all information you need to figure out what happened during payment. Good Luck! |
Hi @DwieDima, "my.app.link" looks kind of strange to me. Not sure if this is a valid URL Scheme identifier. Try one without dots. |
this was not the issue. I finally managed to add PayPal as payment method for future use. I also used instead of: my URL SCHEME in Info.plist
import {
PaymentSheetEventsEnum,
Stripe
} from '@capacitor-community/stripe';
import { App } from '@capacitor/app';
// I'm using here the BUNDLE_IDENTIFIER in my Info.plist
const REDIRECT_URL = 'com.company.appName://stripe-redirect'
@Injectable({
providedIn: 'root'
})
export class PaymentService {
constructor() {
Stripe.initialize({
publishableKey: environment.stripePublishableKey
});
// this is needed to complete the process, so the Stripe Browser is closed for returnUrl
App.addListener('appUrlOpen', async (event) => {
const url = event.url;
const isStripeRedirect = url.includes(REDIRECT_URL);
if (isStripeRedirect) {
// the url from stripe redirect
// com.company.appName://stripe-redirect?redirect_status=succeeded&setup_intent=seti_YOUR_SETI&setup_intent_client_secret=seti_YOUR_CLIENT_SECRET
await Stripe.handleURLCallback({
url
});
}
});
public async confirmCreditCardSetup(
setupIntentResponse: SetupIntentResponse
) {
await Stripe.createPaymentSheet({
customerId: setupIntentResponse.customerId,
setupIntentClientSecret: setupIntentResponse.clientSecret,
customerEphemeralKeySecret: setupIntentResponse.ephemeralKey,
merchantDisplayName: 'Company Name',
style: 'alwaysLight',
returnURL: REDIRECT_URL
});
const { paymentResult } = await Stripe.presentPaymentSheet();
if (paymentResult !== PaymentSheetEventsEnum.Completed) {
return Promise.reject('Payment failed');
}
return Promise.resolve();
}
} result: RPReplay_Final1712328419.MP4 |
Platform
Describe the bug
Paymentsheet not showing all available payment methods
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Paymentsheet on iOS should show the all available payment methods, like on Android
Screenshots
Using Function:
The text was updated successfully, but these errors were encountered: