Pay invoices like a local

Ideal for importers to automate payouts in multiple currencies and manage currency risk.

With our APIs, integrate our accounts payable solution to enable payouts to reconcile directly against invoices, thus eliminating data entry and validation. This helps you automate your operations and securely scale your corporate treasury.

You can combine this with our hedging capabilities to manage your FX risk and protect your profit margins.

API endpoints call sequence

Here is an example of how the APIs can be initiated in a specific sequence to address the use case described above. Feel free to align with our Implementation team if you are looking for additional requirements and optimisations:

  • Request for quote
  • Create a trade
  • Create a beneficiary
  • Initiate the payment
  • Webhooks (get notified on payment status)

Code snippets

Step 1

The first step is to prepare the funds in the currency of the invoice. Use the Get a quote endpoint to obtain a rate.

curl --location -g '{{APP_URL}}/quotes?quote_type=quote&client_id={{client_id}}' \
--header 'Authorization: Bearer {{token}}' \
--header 'X-Contact-ID: {{contact_id}}' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{api_key}}' \
--data '{
  "trade_type": "spot",
  "sell_currency": "GBP",
  "buy_currency": "EUR",
  "amount": 1500,
  "operation": "buy",
  "value_date": "2018-08-31"
}'

Step 2

Call the Book the Trade endpoint, using the quote_id you got in the previous step.

curl --location -g '{{APP_URL}}/trades?quote_id={{quote_id}}&client_id={{client_id}}' \
--header 'X-Contact-ID: {{contact_id}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{token}}' \
--header 'x-api-key: {{api_key}}' \
--data '{
  "trade_type": "spot",
  "reason": "Any reason",
  “external_reference_id”: “your ID to track trade”
}'

Step 3

Call the Create a beneficiary endpoint with the bank data of the individual or organisation who’s invoice you need to clear.

curl --location -g '{{APP_URL}}/beneficiaries?client_id={{client_id}}' \
--header 'Authorization: Bearer {{token}}' \
--header 'X-Contact-ID: {{contact_id}}' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{api_key}}' \
--data-raw '{
    "name": "Sergio Robles",
    "email_addresses": [
        "sergio.robles@ebury.com"
    ],
    "email_notification": "True",
    "address_line_1": "Puerta del Mar nº15",
    "post_code": "29005",
    "country_code": "NL",
    "account_number": "",
    "bank_address_line_1": "Malaga",
    "bank_country_code": "NL",
    "bank_currency_code": "EUR",
    "bank_identifier": "",
    "bank_name": "",
    "correspondent_account": "",
    "correspondent_swift_code": "",
    "iban": "NL38ABNA0462469395",
    "inn": "",
    "kbk": "",
    "kio": "",
    "kpp": "",
    "reason_for_trade": "",
    "reference_information": "Mission Africa",
    "russian_central_bank_account": "",
    "swift_code": "ABNANL2A",
    "vo": ""
}'

Step 4

Trigger the Initiate a payment endpoint. This is a simple endpoint, which can quickly initiate payments to beneficiaries who already exist in the system.

curl --location -g '{{APP_URL}}/payments?client_id={{client_id}}' \
--header 'Authorization: Bearer {{token}}' \
--header 'X-Contact-ID: {{contact_id}}' \
--header 'x-api-key: {{api_key}}' \
--header 'Content-Type: application/json' \
--data '{
        "trade_id": "EBPOTR003771",
        "payments": [
            {
                "beneficiary_id": "EBPBEN15773",
                "account_id": "12804",
                "amount": "2",
                "email_beneficiary": "false",
                "payment_date": "2019-04-26",
                "reference": "testing"
            }
        ]
    }'

Step 5

Finally subscribe to Webhooks to get notifications when statuses change on the payment you just initiated.

curl --location -g '{{APP_URL}}/webhooks/graphql?client_id={{client_id}}' \
--header 'X-Contact-ID: {{contact_id}}' \
--header 'Authorization: Bearer {{token}}' \
--header 'x-api-key: {{api_key}}' \
--header 'Content-Type: application/json' \
--data '{mutation createSubscription { 
            createSubscription( 
               input: { 
                   active: true 
                   secret: "secret" 
                   url: "https://httpbin.org/post" 
                   types: [PAYMENT_STATUS_CHANGE] 
               } 
            ) { 
              subscription { 
                  id 
                } 
        }
     }
  }'