Skip to content

Commit

Permalink
code example
Browse files Browse the repository at this point in the history
  • Loading branch information
acharb committed Dec 6, 2023
1 parent f0d0876 commit 1fb446f
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion docs/building-apps/wallet/sep6.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ An example response:

### 3. Needs more KYC info

Another common response is an HTTP 403, with the response: `non_interactive_customer_info_needed`. In this case the anchor needs more KYC information via [SEP-12]. We'll walk through how to handle this in [Providing KYC info](#providing-kyc-info).
Another common response is an HTTP 403, with the response: `non_interactive_customer_info_needed`. In this case the anchor needs more KYC information via [SEP-12].

An example response:

Expand All @@ -97,6 +97,43 @@ An example response:
}
```

Let's show how a wallet can handle this situation. First, we get the deposit response object. If the response includes this error, then we can see which missing fields the anchor is requiring.

<CodeExample>

```typescript
if (deposit.type === "non_interactive_customer_info_needed") {
// handle displaying the missing fields to the user
console.log(deposit.fields);
}
```

</CodeExample>

The wallet will need to handle displaying to the user which fields are missing. And then to add those fields, we can use the sep12 class like so.

<CodeExample>

```typescript
const sep12 = await anchor.sep12(authToken);

// adding the missing kyc info (sample data)
await sep12.add({
sep9Info: {
family_name: "smith",
given_name: "john",
address: "123 street",
tax_id: "123",
},
});
```

</CodeExample>

Then, we can re-call the deposit method like before and it should be successful.

More information about sending KYC info using [SEP-12] can be found in [Providing KYC info](#providing-kyc-info).

## Providing KYC info

An anchor may respond to a deposit or withdrawal request saying they need additional KYC info. To faciliate this, [SEP-6] supports adding a customer's KYC info via [SEP-12]. The user can send in the required info using the sep12 object like below.
Expand Down

0 comments on commit 1fb446f

Please sign in to comment.