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

Update documentation for unhappy path handling #281

Merged
merged 3 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions docs/src/getting-started/cash-app-pay-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func stateDidChange(to state: CashAppPayState) {
// This Customer Request is in a terminal state and any subsequent actions on this Customer Request will yield an error.
// To retry the customer will need to restart the Customer Request flow.
// You should make sure customers can select other payment methods at this point.
case .redirecting:
// The customer is being redirected to Cash App you can present a loading spinner if desired.
// NOTE: In the event that the customer does not have Cash App installed and navigates back to your app then it is
// up to you to set a reasonable timeout after which you dismiss the loading spinner and treat the Customer Request as failed.
case .integrationError:
// There is an issue with the way you are transitioning between states. Refer to the documentation to ensure you are
// moving between states in the correct order.
Expand Down Expand Up @@ -94,11 +98,11 @@ Your implementation should switch on the `state` parameter and handle the approp
|`approved` |Grants are ready for your backend to use to create a payment.|
|`declined`|Customer has declined the Cash App Pay authorization and must start the flow over or choose a new payment method.|

### Error States

{: .alert }
> Customer Requests can fail for a number of reasons, such as when customer exits the flow prematurely or are declined by Cash App for risk reasons. You must respond to these state changes and be ready to update your UI appropriately.

### Error States

| State | Description |
|:------|:------------|
|`integrationError` |A fixable bug in your integration.|
Expand Down Expand Up @@ -244,6 +248,10 @@ Once the SDK is in the `.readyToAuthorize` state, you can store the associated `

Your app will redirect to Cash App for authorization. When the authorization is completed, your redirect URL will be called and the `RedirectNotification` will post. Then, the SDK will fetch your authorized request and return it to your Observer, as part of the change to the `.approved` state.

### Unhappy Path

If the Customer does not have Cash App installed on thier device then they will redriect to a webpage prompting them to download Cash App. In the event the customer does not download Cash App, then the SDK will remain in the `polling` state. The SDK does not handle this edge case and instead it is up to the implementor to set a reasonable timeout and treat the checkout as failed once that timeout is exceeded. It is suggested to dismiss any loading states and restart the Cash App Pay flow as to not block the customer from checking out.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thier & redirect


## Step 9: Confirm the Cash App Pay Order

Back in Afterpay, confirm the payment using the `checkoutV3` data from step 5 and the `customerRequest.grant` from step 8:
Expand Down
10 changes: 8 additions & 2 deletions docs/src/getting-started/cash-app-pay.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ func stateDidChange(to state: CashAppPayState) {
// This Customer Request is in a terminal state and any subsequent actions on this Customer Request will yield an error.
// To retry the customer will need to restart the Customer Request flow.
// You should make sure customers can select other payment methods at this point.
case .redirecting:
// The customer is being redirected to Cash App you can present a loading spinner if desired.
// NOTE: In the event that the customer does not have Cash App installed and navigates back to your app then it is
// up to you to set a reasonable timeout after which you dismiss the loading spinner and treat the Customer Request as failed.
case .integrationError:
// There is an issue with the way you are transitioning between states. Refer to the documentation to ensure you are
// moving between states in the correct order.
Expand Down Expand Up @@ -97,11 +101,11 @@ Your implementation should switch on the `state` parameter and handle the approp
|`approved` |Grants are ready for your backend to use to create a payment.|
|`declined`|Customer has declined the Cash App Pay authorization and must start the flow over or choose a new payment method.|

### Error States

{: .alert }
> Customer Requests can fail for a number of reasons, such as when customer exits the flow prematurely or are declined by Cash App for risk reasons. You must respond to these state changes and be ready to update your UI appropriately.

### Error States

| State | Description |
|:------|:------------|
|`integrationError` |A fixable bug in your integration.|
Expand Down Expand Up @@ -231,7 +235,9 @@ Once the SDK is in the `.readyToAuthorize` state, you can store the associated `

Your app will redirect to Cash App for authorization. When the authorization is completed, your redirect URL will be called and the `RedirectNotification` will post. Then, the SDK will fetch your authorized request and return it to your Observer, as part of the change to the `.approved` state.

### Unhappy Path

If the Customer does not have Cash App installed on thier device then they will redriect to a webpage prompting them to download Cash App. In the event the customer does not download Cash App, then the SDK will remain in the `polling` state. The SDK does not handle this edge case and instead it is up to the implementor to set a reasonable timeout and treat the checkout as failed once that timeout is exceeded. It is suggested to dismiss any loading states and restart the Cash App Pay flow as to not block the customer from checking out.

### Step 6B: Validate the Cash App Pay Order

Expand Down