Skip to content

Commit

Permalink
docs: add the payment intents functionality to the README.md file
Browse files Browse the repository at this point in the history
  • Loading branch information
daleal committed Dec 9, 2021
1 parent c7dd088 commit 44895d9
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ from fintoc import Fintoc
fintoc_client = Fintoc("your_api_key")
```

This gives us access to a bunch of operations already. The object created using this _snippet_ contains two [managers](#managers): `links` and `webhook_endpoints`.
This gives us access to a bunch of operations already. The object created using this _snippet_ contains three [managers](#managers): `links`, `payment_intents` and `webhook_endpoints`.

#### The `webhook_endpoints` manager

Expand Down Expand Up @@ -232,6 +232,44 @@ webhook_endpoint = fintoc_client.webhook_endpoints.get("we_8anqVLlBC8ROodem")
print(webhook_endpoint.id) # we_8anqVLlBC8ROodem
```

#### The `payment_intents` manager

Available methods: `all`, `get`, `create`.

Payment intents allow you to start a payment using Fintoc! Start by creating a new payment intent:

```python
payment_intent = fintoc_client.payment_intents.create(
currency="CLP",
amount=5990,
recipient_account={
"holder_id": "111111111",
"number": "123123123",
"type": "checking_account",
"institution_id": "cl_banco_de_chile",
}
)

print(payment_intent.id) # pi_BO381oEATXonG6bj
print(payment_intent.widget_token) # pi_BO381oEATXonG6bj_sec_a4xK32BanKWYn
```

Notice that the success of this payment intent will be notified through a Webhook. Now, let's list every payment intent we have:

```python
for payment_intent in fintoc_client.payment_intents.all():
print(payment_intent.id)
```

If you see a payment intent you want to use, just use the `get` method!

```python
payment_intent = fintoc_client.payment_intents.get("pi_BO381oEATXonG6bj")

print(payment_intent.id) # pi_BO381oEATXonG6bj
print(payment_intent.status) # succeeded
```

#### The `links` manager

Available methods: `all`, `get`, `update`, `delete`.
Expand Down Expand Up @@ -320,7 +358,8 @@ If you see a refresh intent you want to use, just use the `get` method!
```python
refresh_intent = link.refresh_intents.get("ri_5A94DVCJ7xNM3MEo")

print(refresh_intent.id) # ri_5A94DVCJ7xNM3MEo
print(refresh_intent.id) # ri_5A94DVCJ7xNM3MEo
print(refresh_intent.status) # succeeded
```

#### The `accounts` manager
Expand Down

0 comments on commit 44895d9

Please sign in to comment.