#_code

1 messages · Page 1 of 1 (latest)

wanton iceBOT
#

👋 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/1404662661433786389

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

tired kite
#

Currently, the IOS client can display PayNow using the same method and in the same environment, but the Android client is unable to display PayNow. Is there a solution to this issue?

vapid viper
#

Can you share the PaymentIntent Id? pi_xxx

#

The one used on your Android app

tired kite
#

here

#

This was obtained temporarily from the production side. Currently, I can successfully open the payment page. However, the only issue is that PayNow cannot be displayed because this clientSecret was created in the Singapore environment.

vapid viper
#

Thanks. Please keep in mind that sharing key (even PublishableKey) is discouraged

#

I recommend remove your Live PublishableKey above

tired kite
#

ok thanks

vapid viper
#

It's not secret key so not end of the world, but please be mindful! This is a public forum

#

Alright you PI does have paynow enabled

tired kite
#

Yes, I also repeatedly confirmed. The official documentation states that "allowsDelayedPaymentMethods(true)" is sufficient for normal operation. However, the result was not satisfactory.

#

Currently, it only shows GrabPay and Card.

#

Could you please tell me the solution?

vapid viper
#

Looking, sorry.

#

Could you clarify which Doc you are looking at?

tired kite
#

Sorry, actually I saw it on the forum. GitHub

#

The version I am currently using is 'com.stripe:stripe-android:21.22.1'

vapid viper
tired kite
#

// Create Stripe SDK
PaymentConfiguration.init(getApplicationContext(), publishableKey);

    // Create PaymentSheet
    paymentSheet = new PaymentSheet(this, this::onPaymentSheetResult);

    Button btnPay = findViewById(R.id.btn_pay);
    btnPay.setOnClickListener(v -> presentPaymentSheet());
}

/**
 *  Pay Result
 */
private void onPaymentSheetResult(PaymentSheetResult paymentSheetResult) {
    if (paymentSheetResult instanceof PaymentSheetResult.Completed) {
        Toast.makeText(this, "pay succeed ✅", Toast.LENGTH_SHORT).show();
    } else if (paymentSheetResult instanceof PaymentSheetResult.Canceled) {
        Toast.makeText(this, "pay cancel ❌", Toast.LENGTH_SHORT).show();
    } else if (paymentSheetResult instanceof PaymentSheetResult.Failed) {
        PaymentSheetResult.Failed failedResult = (PaymentSheetResult.Failed) paymentSheetResult;
        Toast.makeText(this, "pay fail ❌: " + failedResult.getError().getMessage(), Toast.LENGTH_LONG).show();
    }
}

/**
 * Config
 */
private PaymentSheet.Configuration createPaymentSheetConfiguration() {
    return new PaymentSheet.Configuration.Builder("NovoGee Market")
            .allowsDelayedPaymentMethods(true) // 允许异步支付方式(GrabPay、PayNow)
            .build();
}

/**
 *  PaymentSheet
 */
private void presentPaymentSheet() {
    PaymentSheet.Configuration configuration = createPaymentSheetConfiguration();
    paymentSheet.presentWithPaymentIntent(clientSecret, configuration);
}
#

this

#

The method I used was through the Payment Intents API combined with the Stripe Android SDK (PaymentSheet)

vapid viper
#

Hmm looks pretty much normal to me...

#

How about the working iOS code?

#

And do you setup return URL in iOS/Android?

tired kite
#

It seems that there is no way to set the returnURL in my Android client.

#

<activity
android:name=".page.StripePayActivity"
android:exported="true"
android:launchMode="singleTask">

        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data
                android:scheme="novogee"
                android:host="stripe-redirect" />
        </intent-filter> 
    </activity>    Previously, I had attempted to set the callback URL in the manifest file in a manner similar to this.
#

Currently, when the IOS client is invoked, the functions "paynow", "gradpay" and "card" are displayed normally. However, in my Android client, the "paynow" function is missing. The same environment applies.

vapid viper
#

I see...

#

Can you download the QuickStart project here and change the backend to your backend?

wanton iceBOT
tired kite
#

I checked the code in the link you provided and attempted to execute it. The result was consistent with what I have at the moment. However, the "paynow" function still cannot be displayed.

#

This is a screenshot that has been called up.

alpine meadow
#

hi there 👋 taking over the thread from my colleague, give me a moment to catch up

tired kite
#

ok

#

Please take a look first. thank

alpine meadow
#

@tired kite Just want to acknowledge that I'm still looking into this.
In the meantime, could you share with me the Stripe acccount ID being used in your integration? You can find your account id by logging in to https://dashboard.stripe.com/settings/account . It'll have the prefix acct_

tired kite
#

wait

alpine meadow
#

See the second row of the table, PayNow is only supported on mobile payment sheet for iOS only.

tired kite
#

Yes. Currently, the intention is to display PayNow on the Android client. Currently, it has been integrated and is being used on the iOS platform.

alpine meadow
tired kite
#

Where is the second line of the document?

alpine meadow
#

sorry, could you clarify the "second line" you're referring to?

tired kite
#

See the second row of the table, PayNow is only supported on mobile payment sheet for iOS only. Where is this?

alpine meadow
#

Its under the second row (PayNow) and second-last column (Mobile Payment Element)

tired kite
#

Is the current latest SDK also not supported?

alpine meadow
#

no it is not

tired kite
#

OK, I saw it.

#

Do you mean that currently, the official Android version on mobile devices does not support it?

#

Paynow

alpine meadow
#

I am referring to Stripe's Mobile Payment Sheet not supporting PayNow for Android devices right now. I'm not sure what you meant by "official Android version"
But there is a workaround you might want to consider: https://github.com/stripe/stripe-android/issues/6840#issuecomment-1584511698

Although PaymentSheet doesn't support Paynow, you can still support it by creating a PaymentIntent using the params explained in the Direct API Integration guide, obtain the PayNow QR code from PaymentIntent's next_action.paynow_display_qr_code.image_url_png, and use this information to render it in your mobile app.

tired kite
#

Oh, I see. So currently, PaymentSheet doesn't support PayNow on Android mobile devices, right?

alpine meadow
#

yes

tired kite
#

OK. I will consider the solution you mentioned.

#

Thank you for your hard work. If you have any further questions, I will be happy to assist you. Thank you.