Marketplace
The Partner Program is a collaboration model with companies that offer a diverse range of services including implementing e-commerce solutions for their clients and creating their own marketplaces. Within this program, the Partner recommends Tpay services and earns a specified percentage from each invoice for the client they referred.
To use the Tpay Marketplace, you must be part of the Tpay Partner Program. If you are not yet a partner - learn how to join the Program.
Instructions for setting up and managing Tpay marketplace payments in the Partner Panel can be found here.
To start accepting payments in the marketplace model, you must sign an appropriate agreement. Contact your Partner Program representative, who will guide you through the process.
Transaction
After enabling the marketplace functionality for your account, prepare the data to create a transaction:
- Seller ID identifiers.
- The previously added POS ID.
You can obtain seller data identifiers using the method that lists the seller accounts assigned to your marketplace GET /accounts
. You can find the POS ID where you want to create the transaction using the GET /accounts/pos
, method, which lists the POSes of your marketplace.
With the necessary identifiers, you can send a request using the POST
method to:
https://api.tpay.com/marketplace/v1/transaction
.
Check the details in the API Reference documentation: POST /marketplace/v1/transaction
Specify the following parameters in the request:
currency | Currency. |
description | Description of the transaction visible to the payer. |
hiddenDescription | Custom, unique value assigned to the transaction, e.g., orderId. This value will be returned in the webhook notification after successful payment. |
languageCode | Language for displaying the payment page and email notifications. |
pos.id | Point of Sale (POS) - this must be an active, verified POS added to the partner's account. The value is represented by a ULID encoded in base32 format. To check the POS ID, call the /accounts/pos API endpoint. |
billingAddress.email | Payer’s email address. |
billingAddress.name | Payer’s name. |
childTransactions[].amount | Value in cents, e.g., 123.45 PLN should be passed as an integer: 12345. The sum of child transactions must equal the total value of the transaction. At least one child transaction is required. |
childTransactions[].description | Description of the transaction. |
childTransactions[].merchant.id | One of the seller IDs involved in the main transaction, represented by a ULID encoded in base32 format. |
childTransactions[].products | See "Transaction containing products description" below |
The basic request body should look like this:
{ "currency": "PLN", "description": "Example description", "hiddenDescription": "Example hidden description", "languageCode": "PL", "pos": { "id": "01G6WAS5MNGQ2X728AW53D8JPR" }, "billingAddress": { "email": "[email protected]", "name": "Name" }, "childTransactions": [ { "amount": 1500, "description": "Item no1", "merchant": { "id": "01G6WAPZFNNX4CXBPKQH5MYD4R" } }, { "amount": 4000, "description": "Item no2", "merchant": { "id": "01GGA49YQ9NGN0YQV0HW1VHDV3" } } ] }
After sending the request, you will receive a TransactionCreated
schema in response.
The key response parameters:
transactionId | Transaction ID. |
title | Transaction title. |
paymentUrl | URL to redirect the payer to. |
After successfully processing the request, the system will email the payer notifying them of the new transaction.
Redirect the payer to the transaction panel
Redirect the payer to the URL provided in the response under paymentUrl
.
The payer will then choose their preferred payment method on the transaction panel and complete the payment.
Payment authorization
Some payment methods require additional authorizations that the payer must confirm or complete, such as:
- BLIK Code Authorization
- 3D Secure Authorization
- Visa Mobile Authorization
For more details, refer to the documentation of individual payment methods.
The Payer will be redirected to a success or error page
Once the payment is completed, the payer will be redirected to a success page or an error page, depending on the outcome of the transaction.
Await notification of a successful transaction
The payment process in our system is fully asynchronous.
Asynchronous means that the payment process is not performed immediately or within a time period specified upfront. Therefore, while most payment methods will notify us within minutes, the transaction status can change at any time after the transaction creation up to a month from transaction creation.
When the transaction status changes to paid, we will notify your system of the successful payment via a notification. More information on marketplace transaction webhooks can be found here.
On-Site transaction
For some payment methods, on-site integration is possible on-site. To complete an on-site transaction, use the transaction creation endpoint, then, instead of redirecting the user to the paymentUrl
, use the transactionId
parameter to send a POST request to the following URL:
https://api.tpay.com/marketplace/v1/transaction/{transactionId}/pay
Place {transactionId}
in the URL, for example:
https://api.tpay.com/marketplace/v1/transaction/01GENKAM5WKYYDJQ929P7T1MXN/pay
Check the details in the API Reference documentation: POST /marketplace/v1/transactions/{transactionId}/pay
In the request, you can specify the following parameters:
blikPaymentData | BLIK payment data. |
blikPaymentData.blikToken | BLIK token. |
blikPaymentData.aliases | BLIK alias. |
cardPaymentData | Card payment data. |
cardPaymentData.card | Encrypted card data. |
cardPaymentData.token | Card token. |
applePayPaymentData | Apple Pay payment token. |
In the case of a successful response, you may receive additional data, e.g., for card payments, a link to 3DS where you can redirect the payer.
A successful result does not guarantee proper transaction completion: wait for the asynchronous notification from Tpay – this is the final confirmation of payment.
Transaction containing products' description
You can optionally pass a short list of details about the customer's cart to help your implementation differentiate any possible refunds later.
The cart feature is solely intended to help you differentiate the transactions and should not be used as a source of truth for your implementation's other processes.
The list of products should be associated with merchants' supplying them and provided in the products
key of a child transaction.
childTransactions[].products[].name | (optional) Name of the product within your marketplace. |
childTransactions[].products[].externalId | Identifier of the product within your marketplace – it will not be checked for uniqueness or past usage. |
childTransactions[].products[].quantity | quantity of the product within the transaction for given unitPrice . |
childTransactions[].products[].unitPrice | unit price of the product. |
The total amount of the transaction will NOT be checked against the sum of products subtotals. This is done on purpose to allow flexibility of implementation on marketplace's side regarding rounding, fees and net/gross amounts being used.
If your implementation demands it, you can use empty array on child transactions which will not benefit from this function.
The basic request body containing products description should look like this:
{ "currency": "PLN", "description": "Example transaction with products", "hiddenDescription": "example_hidden_description", "languageCode": "PL", "pos": { "id": "01G6WAS5MNGQ2X728AW53D8JPR" }, "billingAddress": { "email": "[email protected]", "name": "Name" }, "childTransactions": [ { "amount": 1500, "description": "Item no1", "merchant": { "id": "01G6WAPZFNNX4CXBPKQH5MYD4R" }, "products": [ { "name": "Cherries (lb)", "externalId": "111.222.33.44", "quantity": 1.2, "unitPrice": 1250 } ] }, { "amount": 4000, "description": "Item no2", "merchant": { "id": "01GGA49YQ9NGN0YQV0HW1VHDV3" }, "products": [ { "name": "Sink", "externalId": "Your.identifier.s1Nk", "quantity": 1, "unitPrice": 4000 } ] } ] }
Refunds
You can request a refund by specifying the amount refunded per merchant account, the products refunded per merchant account (both similar to the data used when creating the transaction), specifying either amount or products per child transaction using child transaction identifiers, or without any data – in which case, you will refund the entire transaction.
During the transaction, we perform appropriate validations, such as whether the maximum refund amount, which is 100% of the paid amount, has not been exceeded, whether in full or appropriately divided into per-merchant amount.
The balances of the merchants for whom the refund is requested are debited the same way as in individual transactions.
The amount needed for the refund and the fee for the operation are deducted from the merchant's balance. If the merchant does not have sufficient funds in the balance, the refund request will be rejected.
Full refund
To issue a full refund, send a POST
request to the endpoint:
https://api.tpay.com/marketplace/v1/transaction/{transactionId}/refund
Replace {transactionId}
with the ID of the transaction you want to refund.
Check the details in the API Reference documentation: POST /marketplace/v1/transaction/{transactionId}/refund
Example URL: https://api.tpay.com/marketplace/v1/transaction/01GENKAM5WKYYDJQ929P7T1MXN/refund
The request body should be an empty JSON object:
Partial refund by amount
To issue a partial refund, send a POST
request to the endpoint:
https://api.tpay.com/marketplace/v1/transaction/{transactionId}/refund
Replace {transactionId}
with the ID of the transaction you want to refund.
https://api.tpay.com/marketplace/v1/transaction/01GENKAM5WKYYDJQ929P7T1MXN/refund
Check details in the API Reference documentation: POST /marketplace/v1/transaction/{transactionId}/refund
In the request, specify the following parameters:
childTransactions[].amount | The amount in cents, e.g., 123.45 PLN should be provided as an integer: 12345. |
childTransactions[].merchantId | (either of merchantId or id is required) One of the merchant IDs involved in the main transaction, represented as a ULID encoded in base32 format. |
childTransactions[].id | (either of merchantId or id is required) One of the child transaction IDs, represented as a ULID encoded in base32 format. |
The basic request body should look like either of the payloads below:
Partial refund by products
To issue a partial refund, send a POST
request to the endpoint:
https://api.tpay.com/marketplace/v1/transaction/{transactionId}/refund
Replace {transactionId}
with the ID of the transaction you want to refund:
https://api.tpay.com/marketplace/v1/transaction/01GENKAM5WKYYDJQ929P7T1MXN/refund
Check details in the API Reference documentation: POST /marketplace/v1/transaction/{transactionId}/refund
In the request, specify the following parameters:
childTransactions[].products[].name | (optional) Name of the refunded product. |
childTransactions[].products[].externalId | (required) externalId that will be checked against the list of products in the transaction. |
childTransactions[].products[].quantity | (required) quantity that will be checked against the list of products in the transaction. |
childTransactions[].products[].unitPrice | (required) unit price of the refunded product. |
childTransactions[].merchantId | (either of merchantId or id is required) One of the merchant IDs involved in the main transaction, represented as a ULID encoded in base32 format. |
childTransactions[].id | (either of merchantId or id is required) One of the child transaction IDs, represented as a ULID encoded in base32 format. |
The basic request body should look like either of the payloads below:
{ "childTransactions": [ { "merchantId": "01G6QRHEBPFAECEWRWVEEPM9WY", "products": [ { "externalId": "111.222.33.44", "quantity": 1.0, "unitPrice": 1250 }, { "externalId": "111.222.33.44", "quantity": 0.2, "unitPrice": 500 } ] }, { "merchantId": "01G6WAPZFNNX4CXBPKQH5MYD4R", "products": [ { "externalId": "Your.identifier.s1Nk", "quantity": 1, "unitPrice": 4000 } ] } ] }
{ "childTransactions": [ { "id": "01JENG92HA094GVX7QT60EP0K9", "products": [ { "externalId": "111.222.33.44", "quantity": 1.0, "unitPrice": 1250 }, { "externalId": "111.222.33.44", "quantity": 0.2, "unitPrice": 500 } ] }, { "id": "01JENG98VYHM1YF0SBDCM66AH9", "products": [ { "externalId": "Your.identifier.s1Nk", "quantity": 1, "unitPrice": 4000 } ] } ] }
List of available payment methods
The available payment methods depend on the settings of the merchants assigned to your marketplace. The list of methods available for the whole transaction is an intersection of payment methods available for all the merchants whose products are a part of the transaction – that is, you can only use methods that are enabled for all the merchants taking part. You can retrieve the list of channels that are enabled on the merchants' accounts for display in the checkout.
To retrieve the list of payment methods for the marketplace, send a GET
request to the endpoint:
https://api.tpay.com/marketplace/v1/bank-groups
In the request, specify the following parameters:
merchantId[] | The merchant's identifier. To include another merchant, use the parameter again. |
Example:
https://api.tpay.com/marketplace/v1/bank-groups?merchantId[]=01G6WAPZFNNX4CXBPKQH5MYD4R&merchantId[]=01G6QRHEBPFAECEWRWVEEPM9WY
Check details in the API Reference documentation: POST /marketplace/v1/bank-groups
This method requires providing the IDs of all merchants involved in the transaction in one call, as it limits the set of returned methods to their intersection. For example, if Merchant 1 does not have installment payments enabled, you cannot choose this method even if other merchants have it enabled.
Transaction cancellation
You can cancel a marketplace transaction provided that the payer has not yet completed the payment.
To cancel a marketplace transaction, send a POST
request to the endpoint:
https://api.tpay.com/marketplace/v1/transaction/{transactionId}/cancel
Replace {transactionId}
with the ID of the transaction you wish to cancel:
https://api.tpay.com/marketplace/v1/transaction/01GENKAM5WKYYDJQ929P7T1MXN/cancel
Check details in the API Reference documentation: POST /marketplace/v1/transaction/{transactionId}/cancel
A successful response to the cancellation request ensures that the payment cannot be completed.
If you have canceled the transaction during the payer's payment process using a method with asynchronous payment notification – we will cancel the payment and refund the money to the payer's account.