Payment Initialization Documentation

Payments initiation process detailed

Prerequisites

To use this service, you will need API keys from the Open Finance dashboard: https://dashboard.open-finance.ai.


Create Token

URL: https://api.open-finance.ai/oauth/token

Method: POST

Request Body

KeyTypeDescriptionExampleRequiredDefault
userIdstringUnique user identifier[email protected]true
clientIdstringProvided in dashboard1234true
clientSecretstringProvided in dashboard1234true

Headers

KeyValue
Content-Typeapplication/json

Example Request

{
  "userId": "[email protected]",
  "clientId": "{{CLIENT_ID}}",
  "clientSecret": "{{CLIENT_SECRET}}"
}

Example Response (Status 200)

{
  "tokenType": "Bearer",
  "expiresIn": 86400,
  "accessToken": "iJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InQ4"
}

Error Responses

  • 401 Unauthorized
    {
      "type": "CLIENT_ERROR",
      "message": "{\"error\":\"access_denied\",\"error_description\":\"Unauthorized\"}"
    }
    
  • 400 Bad Request
    {
      "type": "CLIENT_ERROR",
      "message": "[\"\\\"clientSecret\\\" is required\"]"
    }
    
  • 500 Internal Server Error
    {
      "type": "INTERNAL_ERROR",
      "message": "SERVER_ERROR"
    }
    


  • {
      "type": "INTERNAL_ERROR",
      "message": "SERVER_ERROR"
    }
    

Open Banking Payment Initialization

URL: /pay/open-banking-init

Method: POST

Summary

Initiate a payment with a provider.

Security

  • oAuth2ClientCredentials: create:payments

Request Body

KeyTypeDescriptionExampleRequiredDefault
psuIdstringNational ID or passport number of the user123456789false
psuCorporateIdstringBusiness ID of a customer987654321false
redirectUrlstringThe URL to which the user will be redirected after the payment is completed`https://www.example.comfalse
includeFakeProvidersbooleanUse fake providers for testingtruefalsefalse
providerIdstringUnique provider identifierleumitrue
paymentIdstringID of a previously created payment01HWQ9WMP7NA57YEQ7DQWZHQ5Gfalse
paymentServicestringType of payment servicemasavtrue
paymentInformationobjectPayment detailsSee belowtrue
merchantIdstringA unique identifier for the merchant01HWQ9WMP7NA57YEQ7DQWZHQ5Gfalse

Payment Information

KeyTypeDescriptionExampleRequiredDefault
amountnumberPayment amount100true
currencystringISO-4217 currency codeILStrue
descriptionstringPayment descriptionTransfer for goodstrue
creditorAccountTypestringAccount type of the creditoribantrue
creditorAccountNumberstringAccount number of the creditorIL730200040000000552717true
debtorAccountTypestringAccount type of the debtorbbanfalse
debtorAccountNumberstringAccount number of the debtor10-944-50151142false
creditorNamestringName of the creditorJohn Doetrue

Example Request

{
  "providerId": "leumi",
  "paymentService": "masav",
  "paymentInformation": {
    "amount": 100,
    "currency": "ILS",
    "description": "Test Payment",
    "creditorAccountType": "iban",
    "creditorAccountNumber": "IL730200040000000552717",
    "creditorName": "John Doe"
  }
}

Example Response (Status 201)

{
  "paymentId": "01HWQ9WMP7NA57YEQ7DQWZHQ5G",
  "status": "PENDING",
  "scaOAuth": "https://auth.provider.com/oauth2/authorize"
}

Error Responses

  • 400 Bad Request
    • Missing payment info or invalid provider.
    {
      "type": "CLIENT_ERROR",
      "message": "Needs to provide paymentId or new payment info"
    }
    
  • 401 Unauthorized
    • Invalid or missing token.
    {
      "message": "Unauthorized"
    }
    
  • 404 Not Found
    • Payment or provider not found.
    {
      "type": "CLIENT_ERROR",
      "message": "Payment not found with this id"
    }
    
  • 500 Internal Server Error
    • Unexpected error.
    {
      "type": "INTERNAL_ERROR",
      "message": "An unexpected server error has occurred"
    }
    

Payment Statuses

The payment status indicates the payment transfers status.

Please see the following Payment Status Page


Get Payment

URL: https://api.open-finance.ai/v2/payments/{{PAYMENT_ID}}

Method: GET

Headers

KeyValue
AuthorizationToken created previously

Example Response (Status 200)

{
  "id": "01HA4AEFZS6WQSE46G2NH2FRR1",
  "userId": "[email protected]",
  "providerId": "mizrahi-sandbox",
  "status": "RCVD",
  "amount": "2",
  "currency": "ILS",
  "description": "sdfsdf"
}

Using Sandbox for Payment Initiation

Overview

The sandbox environment allows you to simulate payment initiation with predefined account numbers and statuses. Use the following steps to initiate a payment in the sandbox and interpret the resulting statuses.

Steps

  1. Use one of the predefined account numbers below when initiating a payment.
  2. Depending on the account number used, the payment will finalize with the corresponding status.
  3. When creating the payment you need to mark it as includeFakeProviders: true

Sandbox Account Numbers and Statuses

Account Number IbanAccount Number bbanStatus Code
IL06031114000000043600331-114-436003ACSC
IL50031114000000043666631-114-436666ACSP
IL06031114000000043668231-114-436682CANC
IL38031114000000043668831-114-436688ACFC
IL06031114000000043648831-114-436488PATC
IL41031114000000043644031-114-436440PART
IL12031114000000043628331-114-436283PENDING
IL19031114000000043625431-114-436254ACCC
IL07031114000000043569431-114-435694ACTC
IL61031114000000043578931-114-435789ERROR
IL63031064000000040682131-064-406821ACWC
IL49031124000000027260431-112-272604RJCT

Example Request

{
  "providerId": "leumi",
  "paymentService": "masav",
  "includeFakeProviders": true,
  "paymentInformation": {
    "amount": 100,
    "currency": "ILS",
    "description": "Test Sandbox Payment",
    "creditorAccountType": "bban",
    "creditorAccountNumber": "31-114-436003",
    "creditorName": "John Doe"
  }
}

Example Response (Status 201)

{
  "paymentId": "01HWQ9WMP7NA57YEQ7DQWZHQ5G",
  "status": "RCVD",
  "scaOAuth": "https://url-to-provider.com"
}