Skip to content
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

can not use offline mode after upgrade to 3.2.0 #275

Closed
jonhcbs opened this issue Nov 28, 2023 · 3 comments
Closed

can not use offline mode after upgrade to 3.2.0 #275

jonhcbs opened this issue Nov 28, 2023 · 3 comments

Comments

@jonhcbs
Copy link

jonhcbs commented Nov 28, 2023

Summary

followed the steps in this link https://stripe.com/docs/terminal/features/operate-offline/collect-payments, and connected the reader. but when start to pay offline, it shows error:

An attempt was made to create a PaymentIntent with offline behavior of force offline and the reader in use is not configured to operate offline.

But I did not see the steps that need set the reader to offline manually in the link. any idea what's the issue?

Code to reproduce

let offlineBehavior: OfflineBehavior = {
                  if amount > offlineLimitAmount {
                      return .requireOnline
                  } else {
                      return .forceOffline
                  }
                }()

                let createConfiguration = try CreateConfigurationBuilder().setOfflineBehavior(offlineBehavior).build()
                Terminal.shared.createPaymentIntent(params, createConfig: createConfiguration) { createResult, createError in
                    if let error = createError {
                        ...
                    } else if let paymentIntent = createResult {
                        ...
                    }
                }

iOS version

16+

Installation method

cocoapods

SDK version

3.2.0

Other information

{"readerName":"","connectionStatus":"Connected","readerSN":"STRM26122000091","batteryLevel":"86%","firmwareVersion":"2.01.00.20-SZZZ_Prod_US_v5-480001"}

@bric-stripe
Copy link
Collaborator

Hi, it looks like the location being connected to isn't configured for offline mode. Now that offline mode is in public beta (as of 3.2.0), you must enable offline mode using the configuration API.

If you currently are not using configurations, you'll have a default configuration that you can find with:

curl https://api.stripe.com/v1/terminal/configurations?is_account_default=true -u $SECRET_KEY:

Use the configuration ID, and then you can enable offline for that configuration.

curl https://api.stripe.com/v1/terminal/configurations/<configuration_id> -u $SECRET_KEY: -d "offline[enabled]"=true

See also these docs:
https://stripe.com/docs/terminal/features/operate-offline/collect-payments?terminal-sdk-platform=ios#enable-offline-mode

After enabling offline via the config API, connect to the reader while online to refresh the SDK's settings. Then, you should be able to collect offline payments once again.

@bric-stripe
Copy link
Collaborator

closing this out but please re-open if still seeing this after confirming the location in use has the expected config applied.

@jonhcbs
Copy link
Author

jonhcbs commented Dec 4, 2023

It works, forgot to replay days ago. thanks much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants