PayU
Online payments in Poland through PayU: BLIK, pay-by-link transfers and cards. The app creates an order in PayU and sends the customer to the PayU payment page.
Connection type: For the app and the agent. Credentials: POS ID, Second key (MD5), OAuth client_id, OAuth client_secret.
How it works
The app and the agent never see the credentials. They call the PayU API through the Bloklo gateway, for example fetch("/gw/<connection id>/api/v2_1/paymethods"). The gateway appends the path to the address of the region chosen in the connection (https://secure.snd.payu.com, https://secure.payu.com), adds an OAuth token fetched automatically with the connection's app credentials (client_id and client_secret) and renewed before it expires, and passes the service's response back to the app.
- Reads (GET) go through at once. Writes (POST, PUT, PATCH, DELETE) go through at once only when the connection is set to Always allow; otherwise the gateway returns status 202 with an
approval_idand the write waits for approval in the panel (see Agent permissions). - The Test button sends
GET /api/v2_1/paymethodsand checks that the service accepted the credentials.
REST API 2.1 with JSON bodies and an OAuth token (client_credentials grant, valid about 12 hours, issued at POST /pl/standard/user/oauth/authorize). Amounts are in the smallest currency unit (1000 = 10 PLN); orderId is the identifier assigned by PayU. Order statuses: NEW, PENDING, WAITING_FOR_CONFIRMATION, COMPLETED, CANCELED; status changes also arrive as notifications.
Before you start
- An account with PayU with permission to create API keys or tokens.
Where to get the credentials
- For testing, use the PayU public sandbox point of sale (credentials on the PayU “Sandbox” documentation page) or open your own PayU sandbox account. A sandbox account has different credentials from the live one.
- Sign in to the PayU panel (sandbox or live), open the Online Payments tab and My Shops in the sidebar.
- On the shop tile, open the POS tab and choose the point of sale. The panel shows its configuration keys.
- Copy the POS ID (pos_id), Second key (MD5), OAuth Protocol – client_id and OAuth Protocol – client_secret (as the PayU panel names them) into the Bloklo form and choose the environment that matches the account. All four values must come from the same point of sale.
- The shop currency in PayU must match the site's price list currency (usually PLN). Bank transfers and BLIK work only in PLN, CZK and EUR; cards work in any currency.
- There is no need to set a notification address in the PayU panel: Bloklo sends it with every order. Automatic collection (auto-receive) should stay on (the PayU default).
Connecting in Bloklo
- Open Connectors in the sidebar and find PayU.
- Click Connect and enter a connection name in Details.
- In Configure connection, fill in: POS ID, Second key (MD5), OAuth client_id, Environment.
- Click Connect. Bloklo saves the credentials encrypted and sends a test request; the message shows whether the service responded.
- Attach the connection to a project: Attach to a project… on the connection page, or describe the task in the project chat and pick the connection the agent suggests.
Form fields
- POS ID: the number of the PayU point of sale (POS).
- Second key (MD5): the key used to verify the signature of payment notifications.
- OAuth client_id and OAuth client_secret: the PayU API credentials of the same point of sale.
- Environment: test (sandbox) for a sandbox account, production for real payments.
Never paste credentials into the chat with the agent. Enter them only in the connection form.
Example prompts
Prompts to type in the chat of a project with the connection attached:
- “Add a refund button to the admin panel for a selected order.”
- “Show an order status page after the customer returns from payment.”
- “List the available payment methods on the page.”
API methods
The most commonly used PayU API methods. The path goes after /gw/<connection id>; parts in braces, such as {id}, are replaced with values. The gateway treats every request other than GET as a write, including queries sent with POST (such as search or GraphQL), so they need approval unless the connection is set to Always allow. The full list of methods is in the provider's documentation.
| Method | Path | What it does | In the gateway |
|---|---|---|---|
GET | /api/v2_1/paymethods | List the shop's payment methods | read |
GET | /api/v2_1/orders/{orderId} | Retrieve an order and its status | read |
DELETE | /api/v2_1/orders/{orderId} | Cancel an order | write (approval) |
POST | /api/v2_1/orders/{orderId}/captures | Capture an authorized payment | write (approval) |
GET | /api/v2_1/orders/{orderId}/transactions | Retrieve order transactions | read |
POST | /api/v2_1/orders/{orderId}/refunds | Create a refund | write (approval) |
GET | /api/v2_1/orders/{orderId}/refunds | List refunds for an order | read |
GET | /api/v2_1/orders/{orderId}/refunds/{refundId} | Retrieve a refund | read |
GET | /api/v2_1/shops/{shopId} | Retrieve shop data and balance | read |
Service limits
The documentation gives no numeric request limits; on excessive traffic PayU temporarily blocks access and returns 429 with a Retry-After header (seconds). The sandbox is not meant for performance tests. Order and refund resources are not paginated.
Agent actions and permissions
| Action | Type | What the agent uses it for |
|---|---|---|
| Read data | read | Fetches data from the service, such as a list of records, to build and check the app. Examples: list the shop's payment methods; retrieve an order and its status; retrieve order transactions. |
| Write data | write | Requests other than GET: creating, changing or deleting data in the service, and also queries sent with POST (such as search). Examples: cancel an order; capture an authorized payment; create a refund. |
By default, reads run without asking and writes need approval in the chat. Change this on the connector page or in Settings → Agent permissions (see Agent permissions).
Troubleshooting
The connection test shows “Invalid key” (HTTP 401)
The service did not recognise the credentials: the value is wrong, expired, revoked or was copied with a space. Create a new key at the provider and enter it on the connection page under Change credentials. Empty fields stay unchanged.
The connection test shows “Invalid key” (HTTP 403)
The credentials are rejected or lack the needed permissions, or the service only accepts requests from selected IP addresses. Check the key, extend its permissions at the provider or add the Bloklo gateway IP address (shown in Settings → Privacy & security) to the allowlist.
The test returns another HTTP code
The Test button sends the service a read request that requires valid credentials. A code other than 401 and 403 usually means a temporary problem at the service or a restriction on the account at the provider; include the error code shown with the result in a problem report.
The account is in another region
In the connection form and on the connection page, the Account region field picks the region where the account was created at the provider. With the wrong region the test usually shows “Invalid key”.
Where does the payment amount come from?
From the project's price list (src/cennik.json), calculated by Bloklo on the server. The site only sends product identifiers and quantities, so the customer cannot change the price in the browser. An order is marked as paid only when the provider confirms exactly the order amount. Details: Payments on your site.
The payment succeeded but the order is still pending
The status is changed by a PayU notification sent to the address Bloklo gives with the order. Common causes: a second key (MD5) different from the point of sale's (the notification signature does not match), credentials from a different environment than the one selected, or automatic collection turned off for the point of sale (the payment then waits for collection in the PayU panel, and the order has a note about it). PayU retries the notification many times, so after the credentials are fixed the status changes by itself.
The connection test returns a sign-in error
Bloklo signs in to PayU with the OAuth client_id and OAuth client_secret. Sandbox and live credentials are different, so the Environment field must match the account the keys come from.
The customer sees an error when going to payment
The most common causes according to the PayU documentation: the POS ID and OAuth client_id come from different points of sale, the shop currency in PayU differs from the site's price list currency, or the point of sale has no active payment methods. Error details are in the project log.
Limits and security
- One connection can make up to 1,000 requests per minute; the service's own limits also apply.
- Credentials are encrypted and not shown in the browser after saving; only the names of stored fields are visible.
- A published app works for every visitor: protect the data the connection gives access to with sign-in in the app.
Something unclear or out of date? Contact us