API Reference
Requirements
Allpay API suits Israel-based projects and helps accept payments from clients situated both in Israel and worldwide.
To use the API, you must have an API login and key provided in your Allpay account under Settings ➙ API Integrations. Sign up for Allpay account.
Payment protocol
The payment process involves two steps with the POST method:
- Payment request: This is where a new payment is created. Allpay sends back a URL to the payment page where the customer will be redirected.
- Successful payment notification: After a successful payment, Allpay sends you a notification with the payment details.
Both of these steps use a SHA256 signature to ensure security.
Payment request
To create new payment, a POST request must be sent to the following URL:
The parameters for the POST request are as follows:
The total amount the customer needs to pay will be calculated based on item prices and quantities.
Example: 1000.00
Options:
0 – No VAT (VAT-exempt dealer)
1 – 18% VAT
3 – 0% VAT
Options: ILS, USD, EUR
Options:
AUTO – Auto-detect (browser's language)
AR – Arabic
EN – English
HE – Hebrew
RU – Russian
Note: We don't have a fail URL because payment errors are displayed directly on the payment page, prompting the customer to make a new payment attempt.
Options: Up to 12.
Options:
0 (default) – the customer can choose any number of payments from 1 up to the value of the inst parameter.
1 – the number of payments is fixed and equal to the value of inst And the customer cannot change it.
The Apple Pay module must be activated in your account first.
The Bit module must be activated in your account first.
If set to true, creates a J5 transaction – temporarily reserves the specified amount on the customer's card for up to 168 hours (7 days). No actual charge is made. To collect the funds, a separate request must be sent within the reservation period. Read more about J5 transactions.
Here is the example of a POST payment request:
Response
When a payment request is initiated, Allpay will return a URL (payment_url) to direct the customer to the payment page.
Upon completing the payment, if the transaction is successful, Allpay will redirect the customer to the success_url. However, in the event of a failed payment, the customer will remain on the payment page where an error message will be displayed, along with an option to attempt another payment.
Payment notification
After successful payment, Allpay will submit a POST request to the notifications_url with the following parameters:
1 – successful payment,
3 – refunded.
An order can be considered paid when the returned status is equal to 1 and the the signature is valid.
Code example to verify that the payment was successful:
Signature
Payment requests to Allpay and notifications returned from Allpay includes the 'sign' parameter which represents request signature. The signature is generated with the 'getApiSignature' function.
The <span class="u-richtext-element">getApiSignature</span> function removes the <span class="u-richtext-element">sign</span> parameter and filters out parameters with empty values. It then sorts the remaining parameter keys alphabetically and uses their corresponding values to create a string, joining them with a colon (:) as a separator. The API key is appended to the end of this string, also separated by a colon. Finally, the full string is hashed using the SHA256 algorithm.
Payment status verification
The status of the transaction can be checked by submitting a POST request as follows. The request must be submitted at least 2 seconds after the payment.
Allpay will respond with the following parameters:
1 – successful payment,
3 – refunded.
Options: ILS, USD, EUR
Refund
You can issue a full or partial refund for a sale.
Refunds are made from the amount available for payout to your bank account. If you have had no sales during the month and attempt to issue a refund, there will be no funds to cover it, and the system will return an error.
Example: 1000.00
Subscriptions
This endpoint allows you to manage subscriptions (recurring billing). Currently, only a monthly billing frequency is supported.
To access this endpoint, the Subscriptions Module must be enabled in your Allpay account. You can activate it in Settings ➙ Modules.
Create subscription
The parameters for the POST request are as follows:
The total amount the customer needs to pay will be calculated based on item prices and quantities.
Example: 1000.00
Options:
0 – No VAT (VAT-exempt dealer)
1 – 18% VAT
3 – 0% VAT
Options: ILS, USD, EUR
Options:
AUTO – Auto-detect (browser's language)
AR – Arabic
EN – English
HE – Hebrew
RU – Russian
Note: We don't have a fail URL because payment errors are displayed directly on the payment page, prompting the customer to make a new payment attempt.
Options:
1 – Immediately
2 – On a specific date (use the start_date parameter)
3 – After a specified number of days (use the start_n parameter)
Options:
1 – Infinite (continues until canceled)
2 – Ends on a specific date (use the end_date parameter)
3 – Ends after a specified number of charges (use the end_n parameter)
Example of a POST request to create subscription:
For active subscriptions, notifications are automatically sent to your <span class="u-richtext-element">notifications_url</span> each month after a successful recurring charge.
Cancel subscription
Use this POST request to cancel active subscription:
Allpay will respond with the current status of the subscription:
Options:
1 – Active
2 – Completed
3 – Error
4 – Cancelled
Subscription status verification
Use this POST request to verify the current status of a subscription:
Allpay will respond with the following parameters:
Options:
1 – Active (the last charge was successful, and the next charge is planned).
2 – Completed (all charges were successfully made).
3 – Error (last charge failed, next attempt tomorrow).
4 – Cancelled.
Get all subscriptions
This endpoint allows you to retrieve a list of all subscriptions associated with your account.
Options:
0 – Any status
1 – Active
2 – Completed
3 – Error
4 – Cancelled
If not provided, the first 100 subscriptions will be returned along with the number of the next page (if available). If provided, the response will include 100 subscriptions from the specified page.
Allpay will respond with the following parameters:
Options:
1 – Active
2 – Completed
3 – Error
4 – Cancelled
Get subscriptions statistic
This endpoint allows you to retrieve general statistical information for each subscription type: active, completed, error, and cancelled.
Allpay will respond with the following parameters:
Options:
1 – Active
2 – Completed
3 – Error
4 – Cancelled
currency (string): Subscriptions currency: ILS, USD or EUR.
total_n_currency (numeric): Total number of subscriptions in this currency.
total_amount_currency (numeric): Total monthly amount (turnover) for subscriptions in this currency.
Tokens
A token is a securely captured and encrypted representation of a customer's bank card that can be used to initiate new payments without the need for the customer to re-enter their card details.
You can request a token for any successful payment that was executed using the Payment request. To receive the token submit signed request with the order_id of the original payment.
Allpay will respond with the following parameters:
Now you can use the token to initiate new payment request or new subscription by submitting it with the allpay_token parameter.
The payment will be executed immediately and, instead of the payment page URL, Allpay will return the following parameters:
1 – successful payment.
Before charging the customer's card using a token, you must ensure that you have the customer's explicit permission. Unauthorized charges may result in withdrawal of your acquiring permission and blocking of your Allpay account.
Read our recommendations for building user interfaces that utilize tokens.
Tokens for Bit
Bit does not support tokenization. If the buyer made a payment over Bit, you will not be able to request a token for this payment.
Use the show_bit parameter to hide the Bit button from the payment page if receiving a token is mandatory.
J5 Transactions
A J5 transaction is a two-step payment process that starts with a pre-authorization. The specified amount is reserved on the customer's card for up to 168 hours (7 days), without an actual charge. To complete the payment, the reserved amount must be charged within this period. If no charge is made, the reservation expires automatically.
«J5» is the internal code used by Israeli payment systems to refer to this type of transaction.
The charge can be performed only once and must not exceed the reserved amount. You can charge an amount equal to or less than the original reservation. Any additional or repeated charge attempts will be declined.
Charge
To complete the charge within the pre-authorized amount, submit the order_id of the original payment request and the desired amount to the following endpoint:
The payment will be executed and Allpay will return the following parameters:
1 – successful payment.
Test Mode
To make test payments, activate the Test Mode in your Allpay account: Settings ➙ API Integrations ➙ Test Mode
Test cards
Use any future date as the expiration date and any three digits for the CVV.
Visa: 4557430402053431
MasterCard: 5326105300985846
AmEx: 375516193000090
To simulate failure: 4000000000000002
API Tester
You can use the Allpay API Tester to visually test API requests in both production and test modes.
Additionally, in the Allpay app, you can click on the API tag on a transaction to view the headers and body of the request. Read more.
Changelog
Introducing New J5 Transaction Flow
J5 is a two-step payment process used in Israeli payment systems. It begins with a pre-authorization (reservation) of funds on a customer’s card for up to 168 hours (7 days). During this time, you can charge the reserved amount — fully or partially. If no charge is made, the funds are automatically released.
This is applicable for use cases like deliveries, rentals, variable-weight goods, or custom orders.
Allpay introduces Hosted Fields — a secure way to embed a payment form on a website or in an application, fully adapting it to your design. Tutorial: https://www.allpay.co.il/help/hosted-fields
Added a new parameter show_applepay to the payment request, allowing control over the Apple Pay button visibility on the payment page. The Apple Pay module must be activated in your account first. This parameter is useful in order to hide the button to create a card token, as Apple Pay payments cannot be used for tokenization.
We’re introducing two new tools for developers to test payments via API:
Allpay API Tester
With the Allpay API Tester, you can send requests for new payments, refunds, subscription, and other operations in both live and test modes, simulating requests from your server.
API Tag
Every transaction processed via the API is marked with an "API" tag in Allpay dashboard. Clicking on the tag allows you to view the associated API request and response.
Language support updates. New lang parameter values:
AUTO Automatically sets the payment page language based on the client's browser settings. This is now the default value.
AR Added support for Arabic language.
If the lang parameter is not provided or set to AUTO, the payment page will automatically display in the client's browser language.
Providing EN, RU, HE, or AR in the lang parameter will display the payment page in that language for all clients, regardless of their browser settings.
A language switcher is now available on the payment page, allowing clients to change the language at any time, regardless of the initial lang parameter setting.