Payment creation (Using open-finance UI)

Prerequisites

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


First step

First you have to create a token with your credentials so you can use our API.

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"
    }
    

Second step

After creating the token you can request to create a payment and get back the URL for the payment journey

Create Payment

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

Method: POST

Request Body

KeyTypeDescriptionExampleRequiredDefault
providerIdsarray of stringsUnique bank identifiers["leumi"]falsePredefined list
merchantIdstringUnique merchant identifier01JENRQEA8AYG4MCTVCTH9Y6NJfalsenull
psuIdstringUser ID or Passport321547416falsenull
psuCorporateIdstringBusiness ID of a customer987654321falsenull
allowBusinessbooleanCan the user pay from a business accounttruefalsefalse
isBusinessbooleanDoes the user have to pay from a business accounttruefalsefalse
languageen, hePredetermined language for the payment journeytruefalsenull
iframeboolWhether to embed the journey in an iframefalsefalsefalse
paymentServicestringType of payment servicemasavfalsemasav
directPayOnlybooleanCan the user pay only by a direct paymenttruefalsefalse
includeFakeProvidersbooleanUse fake providers for testingtruefalsefalse
paymentInformationobjectDetails of the paymentSee belowtrue
redirectUrlstringThe URL to which the user will be redirected after the payment is completedhttps://www.example.comfalsenull
externalIdstringAn external id that will be sent in the post message in iframe mode01JENRQEA8AYG4MCTVCTH9Y6NJfalsenull

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

Callback Information

KeyTypeDescriptionExampleRequiredDefault
webhooksobjectWebhook configurationSee belowfalse

Example Request

{
  "providerIds": ["leumi"],
  "psuId": "318422557",
  "paymentInformation": {
    "amount": "100",
    "currency": "ILS",
    "creditorName": "Elon",
    "description": "Test"
  },
  "callbackInformation": {
    "webhooks": {
      "enabled": true,
      "successUrl": "https://www.success.co.il",
      "failUrl": "https://www.fail.co.il"
    }
  }
}

Callback Information

KeyTypeDescriptionExampleRequiredDefault
webhooksobjectWebhook configurationSee belowfalse
successUrlstringThe URL to redirect the user upon successful payment completionhttps://success.examplefalse
failUrlstringThe URL to redirect the user upon payment failurehttps://fail.examplefalse
oauthobjectOAuth configuration used for secure webhook deliverySee belowfalse
customHeadersobjectCustom headers that should be included in webhook requests{ "X-Header": "Value" }false

Webhook Configuration

KeyTypeDescriptionExampleRequiredDefault
enabledboolWhether webhooks are enabledtruefalsefalse
successUrlstringThe URL to redirect the user upon successful payment completionhttps://example.com/successfalse
failUrlstringThe URL to redirect the user upon a failed paymenthttps://example.com/failfalse

OAuth Configuration

KeyTypeDescriptionExampleRequiredDefault
enabledboolWhether OAuth is requiredtruefalsefalse
clientIdstringThe client ID for OAuth123456true
clientSecretstringThe client secret for OAuthabcdeftrue
audiencestringThe audience for the OAuth tokenopen-financefalse
scopestringThe scope of the OAuth tokenread:accountsfalse
tokenUrlstringThe URL to retrieve the OAuth tokenhttps://auth.examplefalse

Example Callback Information

{
  "webhooks": {
    "enabled": true,
    "successUrl": "https://success.example",
    "failUrl": "https://fail.example",
    "oauth": {
      "enabled": true,
      "clientId": "client_id_value",
      "clientSecret": "client_secret_value",
      "audience": "https://api.example.com",
      "scope": "read:accounts write:payments",
      "tokenUrl": "https://auth.example.com/oauth/token"
    },
    "customHeaders": {
      "X-Header-Example": "HeaderValue"
    }
  }
}

 

Example Response (Status 200)

{
  "id": "01HWQ9WMP7NA57YEQ7DQWZHQ5G",
  "payUrl": "http://localhost:3601/su/01J4S4ASB735D5W9FQDP3DWZ6E"
}

Error Responses

  • 401 Unauthorized
    {
      "type": "CLIENT_ERROR",
      "message": "{\"error\":\"access_denied\",\"error_description\":\"Unauthorized\"}"
    }
    
  • 500 Internal Server Error
    {
      "type": "INTERNAL_ERROR",
      "message": "SERVER_ERROR"
    }
    

    • Unexpected error.
    {
      "type": "INTERNAL_ERROR",
      "message": "An unexpected server error has occurred"
    }
    

What is next?

After receiving the payUrl you can redirect your client to this URL so they can authorize the payment through their bank. Using the id you got you can request to get the payment and sample it until you get a success status


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"
}