Skip to content

Commit

Permalink
fix capitalization
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-abrioux committed Oct 26, 2021
1 parent 3deaf9e commit ea84928
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions packages/docs/docs/guides/3-Portal-API/3-create-an-invoice.md
@@ -1,25 +1,25 @@
---
title: Invoice API - Introduction
keywords: [ERC20, DAI, Request, Invoice, Portal, API, Request Invoicing]
description: Learn how to use Request's Invoice API.
description: Learn how to use Request's invoice API.
---

## Request vs. Invoice, how do they differ?
## Request vs. Invoice, How Do They Differ?

You are now familiar with the [Request API](./1-create-and-share-request.md),
but did you know you could also create, on Portal, Invoices which supersede Requests?
but did you know you could also create, on Portal, invoices which supersede requests?

Invoices are simply an implementation of requests with a predefined schema for the `contentData` property.
Invoices are mainly used by the [Request Invoicing](https://invoicing.request.network/) application
as a way to practically represent general invoicing data.

Invoice API also differ by the layer of automation added on top of Request API.
Whenever an Invoice is created, it is possible to have an email sent to the designated payer.
The Invoice issuer (payee) can also get notified as soon as the corresponding request has been paid
Whenever an invoice is created, it is possible to have an email sent to the designated payer.
The invoice issuer (payee) can also get notified as soon as the corresponding request has been paid
(please [contact us](https://www.request.finance/contact-us) if you need more info on this feature).

Knowing if a Request has been paid [is not trivial](./2-payment-status.md).
But Invoices have an additional property: a `status`
But invoices have an additional property: a `status`
; so knowing if the underlying Request has been paid is as easy as reading this property.

Invoices can also be scheduled to create occurrences at regular intervals.
Expand All @@ -30,14 +30,14 @@ To summarize:
| | Request | Invoice |
|---------------------|:-------------:|:-------------:|
| Portal API endpoint | `/requests` | `/invoices` |
| Schema | `contentData`<br/>not validated by API | Invoices extend Requests<br/> `contentData` schema validated by API |
| Schema | `contentData`<br/>not validated by API | Invoices extend requests<br/> `contentData` schema validated by API |
| Automation | ✖️ | ✔ ️ |
| Recurrence | ✖️ ||

## Introduction

In this tutorial we will learn how to use the Invoice API to create off-chain Invoices,
and then transform those Invoices into on-chain Requests.
In this tutorial we will learn how to use the invoice API to create off-chain invoices,
and then transform those invoices into on-chain requests.

Please follow the [Portal Introduction](./0-portal-intro.md) to retrieve an API key.
Reminder: all HTTP requests must include the following headers:
Expand All @@ -49,11 +49,11 @@ Reminder: all HTTP requests must include the following headers:
The Authorization header is used to authenticate yourself.
Please replace `[YOUR_API_KEY]` with the previously retrieved key.

## Create a Request with Invoice API
## Create a Request With Invoice API

### Create an off-chain Invoice
### Create an Off-Chain Invoice

Use the following endpoint first to create an off-chain Invoice that will later be converted to an on-chain Request:
Use the following endpoint first to create an off-chain invoice that will later be converted to an on-chain Request:

`POST https://api.request.network/invoices`

Expand Down Expand Up @@ -134,32 +134,32 @@ In the body part you can use the following example and replace the data accordin
In the JSON response you will get an `id` field. Please save it in a variable or in your database.
You will need it in the next section.

### Convert the off-chain Invoice into an on-chain Request
### Convert the Off-Chain Invoice Into an On-Chain Request

Use the following endpoint to convert the previously created off-chain Invoice to an on-chain Request:
Use the following endpoint to convert the previously created off-chain invoice to an on-chain Request:

`POST https://api.request.network/invoices/[id]`

; and replace `[id]` with the previously saved Invoice ID.
; and replace `[id]` with the previously saved invoice ID.

You don't need to pass anything in the request body this time.

In the JSON response you will get a `requestId` field.
This is the ID of the newly created Request.
Please save it in your database as you will need it to be informed of when the Request has been paid.

### Know when the Request has been paid
### Know When the Request Has Been Paid

In order to be informed as to when the payer has fulfilled the Request you need to poll our API regularly.

Please use the following endpoint to retrieve the status of the Request:

`GET https://api.request.network/invoices/[id] `

Replace `[id]` with the ID of the Invoice, or the ID of the Request `requestId`.
Replace `[id]` with the ID of the invoice, or the ID of the Request `requestId`.

You can check the `status` field of the
JSON response. The different statuses of an Invoice are the following:
JSON response. The different statuses of an invoice are the following:
- `draft`
- `pending`
- `scheduled`
Expand Down

0 comments on commit ea84928

Please sign in to comment.