Using the Test API
The API test mode allows you to learn how to work with the Unitpay API on test data without actually conducting transactions:
- data exchange;
- format of queries and responses;
- content of queries and responses.
To use the API in test mode, you must add the params[test]=1 parameter to the query.
The test data that need to be transmitted in queries:
IMPORTANT NOTE! After switching to operative mode, remember to change the test parameters to actual ones!
For the API in test mode, you should send all the mandatory parameters which can be viewed on the main page of the used method. All the response parameters of the API in test mode correspond to the response in operative mode unless otherwise stated in the test API documentation.
Creating a Payment
initPayment Mandatory method parameters
Other parameters should be specified according to the documentation.
Successful response. The difference of the values of the parameters in test mode:
Warning: the transmitted information will not be saved in test mode. Therefore, the payment information may differ from the values transmitted when creating the payment. The payment receipt number and paymentId will also change after payment using the payment details.
The URL received when creating a payment in test mode is only needed for testing the payment, 3ds authorization, and receipt output. Do not share this link with users!
To test the payment, follow the link from redirectUrl. The link leads to a test form for entering card details. Enter your details and go through 3ds authorization to get the payment status. The money will not be debited using real details.
Test details for payment by card:
After entering the card details, you will switch to the 3ds authorization test form. In the Code field, enter 391745 for a successful payment.
Payment under subscription
Payment under subscription is only available for payments by credit cards. To make a test payment under the subscription, add the subscriptionId parameter with the test value to the initPayment method.
Information about Payment
getPayment Mandatory method parameters
Test paymentId for payments:
Use paymentId from the test responses to get information about the payment.
Important Note: information about the test payment will not be saved. The data received in the response may differ from the data transmitted when creating the payment. The value of purse can be hidden in test mode.
refundPayment Mandatory method parameters
Test paymentId for refund:
Add an optional params[sum] to the request to get various refund events (more or less than the allowed refund amount).
Creating a Payout
massPayment Mandatory method parameters
Test parameters for payouts:
When creating a payout, you can get different statuses. To test them, use the paymentType=card parameter and the following transactionId:
Warning: the created payout will not be saved in test mode. Getting information about the completed test payment using massPaymentStatus will result in an error.
Information about Payout
massPaymentStatus Mandatory method parameters
In test mode, you can only get information about a payout from the list. You can view the test parameters in the table below.
Test transactionId for getting information about payouts:
Getting a List of Active Subscriptions
listSubscriptions Mandatory method parameters
To get a list of test active subscriptions, use the projectId specified in the table The test data that need to be transmitted in queries.
Getting Information About Subscription
getSubscription Mandatory method parameters
In test mode, you can only get information about your subscription by using the subscriptionids listed in the table below.
Closing a Subscription
closeSubscription Mandatory method parameters
In test mode, you can only close a subscription from the table below.
Test subscriptionId of subscriptions:
Important Note: the subscription closing status will not be saved.