Creating your first payment

Take a single payment from your customer's bank account, with the Open Finance screens or directly at the bank.

Take a single payment from your customer's bank account. Your backend creates the payment, the customer approves it at their bank, and Open Finance sends you the result in a webhook. All API calls below run on your backend; the customer only uses the browser.

Token → Create payment → Customer approves at the bank → Webhook → Confirm the status

At a glance

  • What you'll do: create a payment, send the customer to approve it at their bank, then confirm the result.
  • What you need: a token with create:payments and read:payments, and webhooks turned on.
  • What you get back: a payment ID, a webhook when the status changes, and a final status such as ACSC or RJCT.

Before you start

  • Token. Follow Access Tokens to get a token for a stable userId. Create and read the payment with that same userId. Your credentials need create:payments and read:payments. Keep your clientSecret and tokens on your backend.
  • Webhooks. Turn on webhooks in the Dashboard, see Webhooks, or send callbackInformation.webhooks with the payment. Webhooks are sent only when one of the two is enabled.
  • Sandbox. The examples use the open-finance-sandbox bank with includeFakeProviders: true. Sandbox banks must be enabled for your organization, see Testing with fake bank data.

The examples use API_BASE=https://api.open-finance.ai/v2 and ACCESS_TOKEN containing the user's token.

How the sandbox decides the result

The sandbox has no bank page. The debtor account (the customer's account) decides the result:

Debtor accountBBANResult
IL06031114000000043600331-114-436003ACSC
IL49031124000000027260431-124-272604RJCT

Testing with fake bank data lists an account for every other status.

Choose how to create the payment

With Open Finance screensDirectly with init
Use it whenYou want Open Finance to ask the customer for their bank and accountYou already know the customer's bank and ID number and want to send them straight to the bank
EndpointPOST /v2/paymentsPOST /v2/pay/open-banking-init
You sendThe amount, description and creditor. Optional: the banks to offer (providerIds), the customer's ID number and accountThe bank (providerId), the customer's ID number (psuId), the amount, description and creditor. Optional: the customer's account
You get backid and payUrl, a link to the Open Finance payment journeypaymentId, status and scaOAuth, the bank's approval link
First statusINITThe bank's status, usually RCVD
The customerPicks the bank, enters the account, approves at the bankApproves at the bank
Link valid forpayUrl: 24 hours from creationscaOAuth: a few minutes, and the time differs per bank

Both create the same kind of payment, send the same payment webhook and end in the same statuses. Pick a tab to follow one of them. To compare every payment and mandate flow, see Open Finance screens or straight to the bank.

1. Get a token

curl --request POST "https://api.open-finance.ai/oauth/token" \
  --header "Content-Type: application/json" \
  --data "{\"userId\":\"customer-1001\",\"clientId\":\"$CLIENT_ID\",\"clientSecret\":\"$CLIENT_SECRET\"}"

Save accessToken from the response as ACCESS_TOKEN. See the token endpoint for details.

2. Create the payment

curl --request POST "$API_BASE/payments" \
  --header "Authorization: Bearer $ACCESS_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "includeFakeProviders": true,
    "providerIds": ["open-finance-sandbox"],
    "redirectUrl": "https://your-app.example/payment-return",
    "paymentInformation": {
      "amount": 100,
      "currency": "ILS",
      "description": "Order 1001",
      "creditorAccountType": "iban",
      "creditorAccountNumber": "IL730200040000000552717",
      "creditorName": "Example Store"
    }
  }'

A successful response is HTTP 201 with id and payUrl. Save id as PAYMENT_ID. The payment is now INIT.

What each field does
FieldPurpose
includeFakeProvidersShows sandbox banks. Remove it for real banks.
providerIdsThe banks the customer can choose from. With one bank, it is already selected for the customer. Leave it out to offer every bank.
redirectUrlWhere the browser goes when the payment is done. Use an allowed domain if your organization restricts redirects. Without it, your organization's payment redirect URL is used; without either, the customer sees the Open Finance result screen.
paymentInformationThe amount, currency, description and creditor (the account that receives the money).

See Payment creation (Using open-finance UI) for every field.

3. Send the customer to payUrl

Open payUrl in the customer's browser. The link is valid for 24 hours. The customer picks the bank, enters the account and ID number, and continues to the bank.

The payment journey: start, enter the account, payment approved

What your client sees after you open payUrl (sandbox data)

When the customer continues, Open Finance creates the payment at the bank and sends the customer there. That is the moment the customer goes to the bank: the status becomes the bank's status, usually RCVD, and you get a webhook.

In the sandbox, enter branch 114 and account 436003 with any ID number to get ACSC. To embed the journey in your app, see Connection/Payment Journey.

4. The customer comes back

After approving at the bank, the customer returns to Open Finance. Open Finance reads the result from the bank and redirects the browser to your redirectUrl:

https://your-app.example/payment-return?paymentId=01HWQ9WMP7NA57YEQ7DQWZHQ5G&paymentStatus=ACSC&userId=customer-1001
📘

The redirect is not the confirmation

The customer can close the browser before the redirect, and anyone can edit a URL. Confirm the payment with the webhook and the API.

5. Confirm the final status

When the webhook arrives, or when the customer is back, read the payment:

curl "$API_BASE/payments/$PAYMENT_ID" \
  --header "Authorization: Bearer $ACCESS_TOKEN"
statusMeaningWhat to do
ACSC, ACCC, ACSP, ACTC, ACWC, ACFCThe bank accepted the paymentFinal. Complete the order.
RJCTThe customer or the bank refused it, or it expiredFinal. Create a new payment to try again.
PENDING, PATCWaiting for a bank approval or more signersWait for the next webhook.
ERRORSomething failed. See errorNot always final. Wait for the next webhook.
INIT, RCVDThe customer has not finishedWait.

While the payment is not final, GET /v2/payments/{paymentId}/status asks the bank for its status right now. See Payment Statuses for every status and how it changes.

What happens, step by step

---
config:
  sequence:
    mirrorActors: false
    actorMargin: 24
    width: 110
---
sequenceDiagram
    autonumber
    participant YB as Your backend
    participant OF as Open Finance
    participant CB as Customer (browser)
    participant BK as Bank
    YB->>OF: POST /oauth/token
    OF-->>YB: accessToken
    YB->>OF: POST /v2/payments
    OF-->>YB: 201 with id and payUrl
    OF--)YB: Webhook INIT
    YB->>CB: Open payUrl
    CB->>OF: Pick the bank and account
    OF->>BK: Create the payment
    BK-->>OF: RCVD
    OF--)YB: Webhook RCVD
    OF->>CB: Redirect to the bank
    CB->>BK: Log in and approve
    BK->>CB: Back to Open Finance
    CB->>OF: Return from the bank
    OF->>BK: Read the status
    BK-->>OF: For example ACSC
    OF--)YB: Webhook ACSC
    OF->>CB: To your redirectUrl
    CB->>YB: paymentId, userId, paymentStatus
    YB->>OF: GET /v2/payments/paymentId
    OF-->>YB: status ACSC
    opt Status is not final yet
        OF->>BK: Hourly re-check
        OF--)YB: Webhook with the new status
    end
WebhookWhen it's sentpaymentStatusWhat to do
1Right after POST /paymentsINITSave paymentId. Nothing to do yet.
2The customer picked a bank and Open Finance created the payment thereRCVDThe customer is at the bank. Wait.
3The customer is back from the bank, or a little earlier if Open Finance reads the result from the bank firstAn accepted status, RJCT, PENDING, PATC or ERRORAccepted or RJCT: read the payment and act. Otherwise wait.
4 and laterAbout once an hour, while the payment is not final, when the bank reports a changeThe new statusAs for webhook 3.
Instead of 2The customer never picked a bank. About 24 hours after creationRJCTThe payment expired. Create a new one if needed.

The same status is never sent twice in a row. The webhook does not carry the payment details, so read the payment after each one. See Event Types.

Webhook timing in the sandbox

In the sandbox, webhook 2 is sent when the customer continues, and webhook 3 when the journey completes the payment.

Create a payment from the Dashboard

You can also create a payment without writing code. In the Dashboard, open Payments and click Create New Payment. Choose a merchant, an amount and a description. The Dashboard creates the payment as in the With Open Finance screens tab, opens payUrl in a new tab, and shows the link so you can copy it.

The Create New Payment dialog in the Dashboard, with Future Payment turned on and a Payment Date

Dashboard → Payments → Create New Payment (sample values)

Before using real banks

Confirm production access with Open Finance. Remove includeFakeProviders and the sandbox providerIds or providerId, and send the customer's psuId to open-banking-init.

Test refusal (RJCT), PENDING, PATC and ERROR as well as success. The sandbox has a debtor account for each.

Next steps


Did this page help you?