For platforms or as white label

For businesses running a platform that would like to issue ZATCA phase 2 compliant invoices, credit notes and debit notes on behalf of their users.

If you're a platform or a marketplace, you can issue ZATCA-compliant phase 2 invoices on behalf of your customers with the Connected Account API.

The Connected Account API allows you to onboard your customers to Fatoora programmatically, without them having any knowledge or need to create an account on Wafeq. You will then be able to issue invoices on their behalf and report them to ZATCA.

For example, say you're an e-commerce platform that lets merchants create online stores. You'd like to offer your merchants the ability to issue Phase 2 invoices for orders placed by their customers. You will use the Connected Account API to have them connect their Fatoora portal and start issuing invoices on their behalf.

Here's how you would use Connected Accounts to report an invoice on behalf of your customer:

  1. Create connected account for your customer:
curl --request POST \
     --url https://api.wafeq.com/v1/zatca/connected-accounts/ \
     --header 'Authorization: Api-Key <Your API Key>' \
     --header 'Content-Type: application/json' \
     --data '
{
  "name": "ABCD Inc",
  "address": "Anas Bin Malik, Al Malqa",
  "city": "Riyadh",
  "country": "SA",
  "business_category": "Manufacturing",
  "tax_registration_number": "311111111111113"
}
'
  1. Register a device on behalf of the connected account. You will need to ask your customer to obtain an OTP from their Fatoora portal:
curl --request POST \
     --url https://api.wafeq.com/v1/zatca/devices/register/ \
     --header 'Authorization: Api-Key <Your API Key>' \
     --header 'Content-Type: application/json' \
     --header 'X-ZATCA-Environment: production' \
     --header 'X-ZATCA-Connected-Account-ID: <ID of the connected account from step 1>' \
     --data '
{
  "common_name": "Device 1",
  "otp": "111111"
}
'
  1. Report an invoice on behalf of the connected account
curl --request POST \
     --url https://api.wafeq.com/v1/zatca/invoices/report/ \
     --header 'Authorization: Api-Key <Your API Key>' \
     --header 'Content-Type: application/json' \
     --header 'X-ZATCA-Environment: production' \
     --header 'X-ZATCA-Connected-Account-ID: <ID of the connected account from step 1>' \
     --data '
{
   ...
}
'