Skip to content

Commit 0da4e3b

Browse files
committed
docs: clarify google pay requirements
1 parent 574acfb commit 0da4e3b

File tree

1 file changed

+34
-38
lines changed

1 file changed

+34
-38
lines changed

docs/sheet.mdx

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ description: Accept a payment with Payment Sheet.
77

88
### Securely accept payments online.
99

10-
<img src="https://b.stripecdn.com/docs-statics-srv/assets/bd5ffc39f955d37bb53ef7d854ae4474.png" height="36" />
10+
<img
11+
src="https://b.stripecdn.com/docs-statics-srv/assets/bd5ffc39f955d37bb53ef7d854ae4474.png"
12+
height="36"
13+
/>
1114

1215
Integrate Stripe’s prebuilt payment UI into the checkout of your app with the PaymentSheet class.
1316

1417
This integration combines all of the steps required to pay—collecting payment details and confirming the payment—into a single sheet that displays on top of your app.
1518

16-
1719
## 1. Set up Stripe [Server Side] [Client Side]
1820

1921
First, you need a Stripe account. [Register now](https://dashboard.stripe.com/register).
@@ -27,14 +29,13 @@ This integration requires endpoints on your server that talk to the Stripe API.
2729
The Flutter SDK is open source, fully documented.
2830

2931
To install the SDK, follow these steps:
30-
- Run the commmand `flutter pub add flutter_stripe`
31-
- This will add a line like this to your project's pubspec.yaml with the latest package version
3232

33+
- Run the commmand `flutter pub add flutter_stripe`
34+
- This will add a line like this to your project's pubspec.yaml with the latest package version
3335

3436
For details on the latest SDK release and past versions, see the [Releases](https://github.com/flutter-stripe/flutter_stripe/releases) page on GitHub. To receive notifications when a new release is published, [watch releases for the repository](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/managing-subscriptions-for-activity-on-github/viewing-your-subscriptions#watching-releases-for-a-repository).
3537

36-
37-
When your app starts, configure the SDK with your Stripe [publishable key](https://dashboard.stripe.com/) so that it can make requests to the Stripe API.
38+
When your app starts, configure the SDK with your Stripe [publishable key](https://dashboard.stripe.com/) so that it can make requests to the Stripe API.
3839

3940
```dart
4041
void main() async {
@@ -59,7 +60,7 @@ This integration uses three Stripe API objects:
5960

6061
3. A Customer Ephemeral Key (optional). Information on the Customer object is sensitive, and can’t be retrieved directly from an app. An Ephemeral Key grants the SDK temporary access to the Customer.
6162

62-
>> If you never save cards to a Customer and don’t allow returning Customers to reuse saved cards, you can omit the Customer and Customer Ephemeral Key objects from your integration.
63+
> > If you never save cards to a Customer and don’t allow returning Customers to reuse saved cards, you can omit the Customer and Customer Ephemeral Key objects from your integration.
6364
6465
For security reasons, your app can’t create these objects. Instead, add an endpoint on your server that:
6566

@@ -123,6 +124,7 @@ Future<void> initPaymentSheet() async {
123124
```
124125

125126
When the customer taps a **Checkout** button, call present to present the payment sheet. After the customer completes the payment, the sheet is dismissed.
127+
126128
```dart
127129
await Stripe.instance.presentPaymentSheet();
128130
```
@@ -135,65 +137,66 @@ await Stripe.instance.confirmPaymentSheetPayment();
135137

136138
Unless your business model requires immediate payment (e.g., an on-demand service), don’t assume you have received payment at this point. Instead, inform the customer that you confirmed their order and notify them by email when you fulfill their order in the next step.
137139

138-
>> ADD MORE PAYMENT METHODS
139-
>> While cards finish payment by this point, other payment methods can take time to process before payment is complete. By not assuming you’ve received payment on the client, you can add additional payment methods in the future without updating your app.
140+
> > ADD MORE PAYMENT METHODS
141+
> > While cards finish payment by this point, other payment methods can take time to process before payment is complete. By not assuming you’ve received payment on the client, you can add additional payment methods in the future without updating your app.
140142
141-
142-
## 4. Handle post-payment events
143+
## 4. Handle post-payment events
143144

144145
Stripe sends a [`payment_intent.succeeded`](https://stripe.com/docs/api/events/types#event_types-payment_intent.succeeded) event when the payment completes. Use the Dashboard, a custom webhook, or a partner solution to receive these events and run actions, like sending an order confirmation email to your customer, logging the sale in a database, or starting a shipping workflow.
145146

146147
Listen for these events rather than waiting on a callback from the client. On the client, the customer could close the browser window or quit the app before the callback executes. Setting up your integration to listen for asynchronous events also makes it easier to accept more payment methods in the future. Check out our [guide to payment methods](https://stripe.com/payments/payment-methods-guide) to see the differences between all supported payment methods.
147148

148-
149149
## 5. Test the integration
150150

151151
Several test cards are available for you to use in test mode to make sure this integration is ready. Use them with any CVC, postal code, and future expiration date.
152152

153-
| NUMBER | DESCRIPTION |
154-
| ------ | ------- |
155-
| 4242424242424242 | Succeeds and immediately processes the payment. |
156-
| 4000002500003155 | Requires authentication. Stripe will trigger a modal asking for the customer to authenticate. |
157-
| 4000000000009995 | Always fails with a decline code of insufficient_funds. |
153+
| NUMBER | DESCRIPTION |
154+
| ---------------- | --------------------------------------------------------------------------------------------- |
155+
| 4242424242424242 | Succeeds and immediately processes the payment. |
156+
| 4000002500003155 | Requires authentication. Stripe will trigger a modal asking for the customer to authenticate. |
157+
| 4000000000009995 | Always fails with a decline code of insufficient_funds. |
158158

159159
For the full list of test cards see the guide on [testing](https://stripe.com/docs/testing).
160160

161-
162161
## 6. Optional - Enable Apple Pay (Only iOS)
163162

164163
#### Register for an Apple Merchant ID
164+
165165
Obtain an Apple Merchant ID by [registering for a new identifier](https://developer.apple.com/account/resources/identifiers/add/merchant) on the Apple Developer website.
166166

167167
Fill out the form with a description and identifier. Your description is for your own records and you can modify it in the future. Stripe recommends using the name of your app as the identifier (e.g., `merchant.com.{{YOUR_APP_NAME}}`).
168168

169169
#### Create a new Apple Pay certificate
170+
170171
Create a certificate for your app to encrypt payment data.
171172

172173
In the Dashboard’s [Apple Pay Settings](https://dashboard.stripe.com/settings/payments/apple_pay), click **Add new application** and follow the guide there.
173174

174175
#### Integrate with Xcode
176+
175177
Add the Apple Pay capability to your app. In Xcode, open your project settings, click the **Signing & Capabilities** tab, and add the **Apple Pay** capability. You might be prompted to log in to your developer account at this point. Select the merchant ID you created earlier, and your app is ready to accept Apple Pay.
176178

179+
<img
180+
src="https://b.stripecdn.com/docs/assets/xcode.a05220aeae26f8b793b5694692a79117.png"
181+
height="36"
182+
/>
177183

178-
<img src="https://b.stripecdn.com/docs/assets/xcode.a05220aeae26f8b793b5694692a79117.png" height="36" />
184+
#### Add Apple Pay
179185

180-
#### Add Apple Pay
181-
To add Apple Pay to PaymentSheet,
186+
To add Apple Pay to PaymentSheet,
182187
Make sure to set your Apple merchant ID `Stripe.merchantIdentifier` when you init stripe instance in your `main.dart`
183188

184189
[Check stripe docs](https://support.stripe.com/questions/enable-apple-pay-on-your-stripe-account) for enabling Apple Pay on your Stripe account & create merchantIdentifier
185190

186-
187191
```dart
188192
Stripe.publishableKey = stripePublishableKey;
189193
Stripe.merchantIdentifier = 'merchant.flutter.stripe.test';
190194
Stripe.urlScheme = 'flutterstripe';
191195
await Stripe.instance.applySettings();
192196
```
193197

198+
then add `applePay: PaymentSheetApplePay()` with the country code of your business.
194199

195-
then add `applePay: PaymentSheetApplePay()` with the country code of your business.
196-
197200
```dart
198201
Stripe.instance.initPaymentSheet(
199202
paymentSheetParameters: SetupPaymentSheetParameters(
@@ -211,7 +214,7 @@ Stripe.instance.initPaymentSheet(
211214

212215
#### Set up your integration
213216

214-
To use Google Pay, first enable the Google Pay API by adding the following to the `<application>` tag of your AndroidManifest.xml:
217+
To use Google Pay, enable the Google Pay API by adding the following to the `<application>` tag of your AndroidManifest.xml:
215218

216219
AndroidManifest.xml
217220

@@ -224,15 +227,7 @@ AndroidManifest.xml
224227
</application>
225228
```
226229

227-
This guide assumes you’re using the latest version of the Stripe Android SDK.
228-
229-
build.gradle
230-
231-
```
232-
dependencies {
233-
implementation 'com.stripe:stripe-android:17.1.1'
234-
}
235-
```
230+
This guide assumes you’re using the latest version of the Stripe Android SDK.
236231
For more details, see Google Pay’s Set up Google Pay API for Android.
237232

238233
#### Add Google Pay
@@ -256,11 +251,12 @@ Stripe.instance.initPaymentSheet(
256251

257252
To enable card scanning support, set the `NSCameraUsageDescription` **(Privacy - Camera Usage Description)** in the Info.plist of your application, and provide a reason for accessing the camera (e.g., “To scan cards”). Devices with iOS 13 or higher support card scanning.
258253

259-
## 9. Optional - Customize the sheet
254+
## 9. Optional - Customize the sheet
260255

261256
All customization is configured through the SetupPaymentSheetParameters object.
262257

263258
### Merchant display name
259+
264260
You can specify a customer-facing business name that Stripe uses to display a “Pay (merchantDisplayName)” line item in the payment sheet. By default, this is your app’s name.
265261

266262
```dart
@@ -273,10 +269,10 @@ Stripe.instance.initPaymentSheet(
273269

274270
### Change appearance
275271

276-
From version `3.1.0` and higher it is possible to change the appearance of the payment_sheet.
272+
From version `3.1.0` and higher it is possible to change the appearance of the payment_sheet.
277273

278274
```dart
279-
await Stripe.instance.initPaymentSheet(
275+
await Stripe.instance.initPaymentSheet(
280276
appearance: PaymentSheetAppearance(
281277
colors: PaymentSheetAppearanceColors(
282278
background: Colors.lightBlue,
@@ -297,6 +293,6 @@ From version `3.1.0` and higher it is possible to change the appearance of the p
297293
),
298294
),
299295
),
300-
),
296+
),
301297
);
302298
```

0 commit comments

Comments
 (0)