# Example

## Example
The following is brief complete workflow for using a payment link.
1) Create a payment link for a transaction.<br>
Use : `POST /v2/payment-links`.<br>
Partial request body:

```json
   {
       "linkType": "SingleUse",
       "baseAmount": 75,
       "currencyCode": "USD",
       "paymentMethods": {
           "card": {
            "enabled": true
           }
       }
   }
```
Partial response body:

```json
   {
        "paymentLinkId": "6f2a8b3c-9d4e-4f1a-8b7c-3e5d6a9f0c1b", 
        "shortUrl": "https://pay.example.com/l/abc123",
        ...
   }
```
This returns:
* The `paymentLinkId`, a UUID identifier for this payment link.
* The `shortUrl`, a URL the customer can open to complete the payment.

2) Share the payment link with the customer so they can complete the transaction.<br>
This may be done either:
* Using: `POST /v2/payment-links/{{paymentLinkId}}/share`.
This endpoint sends the payment link to the customer described in the endpoint.
* Send the returned `shortUrl` directly through any other channel, such as a text or email.

3) The customer opens the shared payment link and completes the payment on Flute's hosted checkout page.
4) Verify the payment.<br>
Poll the payment link using: `GET /v2/payment-links/{{paymentLinkId}}`
Partial response body:

```json
   {
        "paymentLinkStatus": "Completed", 
        "paymentCount": 1,
        "totalCollectedAmount": 75,
        ...
   }
```
Check that `paymentLinkStatus` is `Completed`.
If so, `paymentCount` and `totalCollectedAmount` should reflect the transaction.
Together, these verify the transaction completed successfully.

Version: V2 Beta
Security: Bearer
