Testing payments
This article will guide you through the process of trying out payments in test mode. Payments in test mode are similar to real payments, except real money is not transferred anywhere.
About test mode
Test mode is available in your Merchant Profile right after you sign up: you can test payments at any moment, even before you enter the information about your company or enter into a contract.
To use test mode, you need to sign up for the YooMoney Merchant Profile and create a demo store.
All the main features of the API are available in test mode, even the ones you can only get for the real store by contacting your YooMoney manager.
Specifics of test mode:
- the ID and secret key of the demo store must be used for authenticating requests;
- special test data must be specified in the requests (depending on which features you’d like to test);
- the
test
parameter has valuetrue
in payment objects created for the demo store.
Example of a test payment
JSON
{ "id": "23d93cac-000f-5000-8000-126628f15141", "status": "pending", "paid": false, "amount": { "value": "2.00", "currency": "RUB" }, "confirmation": { "type": "redirect", "confirmation_url": "https://yoomoney.ru/api-pages/v2/payment-confirm/epl?orderId=23d93cac-000f-5000-8000-126628f15141" }, "created_at": "2019-01-22T14:30:45.129Z", "description": "Order No. 1", "metadata": {}, "recipient": { "account_id": "100500", "gateway_id": "100700" }, "refundable": false, "test": true }
Testing options
You can test all the features of the API, including recurring payments and submitting data for receipts in accordance with 54-FZ, for the following payment methods:
- bank cards:
- on the YooMoney page;
- using a token (
payment_token
) obtained via Checkout.js or mobile SDK); - on your page (if you have a PCI DSS certificate);
- YooMoney wallet.
Demo store
You can create a demo store either before or after you sign up for YooMoney.
If you haven’t signed up for YooMoney
Sign up for YooMoney using this link. In the process, you’ll see two options: continue sign-up or proceed to testing payments. Select testing payments. You’ll see the created demo store.
If you have a YooMoney Merchant Profile
Add the demo store via the YooMoney Merchant Profile and set up the required parameters. The demo store will appear in the list of your stores within a minute after the creation.
You can create up to 20 demo stores.
Testing the integration
Step 1. Get the ID and secret key of the demo store. They're required for authenticating requests.
Step 2. Configure the demo store:
- If necessary, configure notifications in the Integration — HTTP notifications section.
- If you use YooMoney's solution for 54-FZ, enable the receipt verification mode in the Settings — Online sales register section.
Step 3. Select the features you'd like to test:
- Payments via bank cards
- Payments via YooMoney wallets
- Autopayments (recurring payments)
- Working with receipts (payments in accordance with 54-FZ)
Step 4. Follow the instructions to test the selected features.
Don't ship products sold via the demo store. To avoid problems, use a separate URL for test notifications from YooMoney (specify it in the demo store settings in your Merchant Profile).
Payment via a bank card
Test bank cards
Do not use real bank cards in the demo store: you can test payment acceptance using of the test cards.
Test bank cards of different payment systems are displayed below: you can choose any card for testing. Specify any month and year (exceeding the current date) for the expiration date, and any numbers for the CVC and the 3-D Secure confirmation code.
Testing successful scenarios
When testing recurring payments, use the test bank cards without 3-D Secure, otherwise the autopayment won’t go through.
You can use bank cards of different payment systems to test payments:
Number | Type of card | 3-D Secure |
---|---|---|
5555555555554477 | Mastercard | ✔️ |
5555555555554444 | Mastercard | ➖ |
6759649826438453 | Maestro | ➖ |
4793128161644804 | Visa | ✔️ |
4111111111111111 | Visa | ➖ |
4175001000000017 | Visa Electron | ➖ |
2200000000000004 | Mir | ✔️ |
2202474301322987 | Mir | ➖ |
370000000000002 | American Express | ➖ |
3528000700000000 | JCB | ➖ |
36700102000000 | Diners Club | ➖ |
Testing unsuccessful scenarios
If you want to test the
cancellation_details
parameter value for unsuccessful payments, use any test bank cards of different payment systems.Transaction cancelled by “external” participants of the payment process (payment_network)
Card number | Reason behind the cancelation |
---|---|
5555555555554592 (Mastercard) 4839665499603842 (Visa) 2200000000000012 (Mir) | 3d_secure_failed |
5555555555554535 (Mastercard) 4926946416239025 (Visa) 2200000000000020 (Mir) | call_issuer |
5555555555554543 (Mastercard) 4141435412630840 (Visa) 2200000000000038 (Mir) | card_expired |
5555555555554568 (Mastercard) 4483274282299972 (Visa) 2200000000000046 (Mir) | fraud_suspected |
5555555555554527 (Mastercard) 4889971706588753 (Visa) 2202202212312379 (Mir) | general_decline |
5555555555554600 (Mastercard) 4562265587712390 (Visa) 2200000000000053 (Mir) | insufficient_funds |
5555555555554618 (Mastercard) 4951017853630544 (Visa) 2201382000000013 (Mir) | invalid_card_number |
5555555555554626 (Mastercard) 4194180666146368 (Visa) 2200770212727079 (Mir) | invalid_csc |
5555555555554501 (Mastercard) 4654130848359150 (Visa) 2201382000000021 (Mir) | issuer_unavailable |
5555555555554576 (Mastercard) 4565231022577548 (Visa) 2201382000000039 (Mir) | payment_method_limit_exceeded |
5555555555554550 (Mastercard) 4233961169071671 (Visa) 2201382000000047 (Mir) | payment_method_restricted |
Transaction cancelled by YooMoney (yoo_money)
Card number | Reason behind the cancelation |
---|---|
5555555555554584 (Mastercard) 4969751510013864 (Visa) 2201382000000054 (Mir) | country_forbidden |
5555555555554634 (Mastercard) 4119098878796485 (Visa) 2201696981989955 (Mir) | fraud_suspected |
Payment from the YooMoney wallet
You do not need a test wallet to test payments via YooMoney for Shopping, as transactions in the demo store are carried out without an actual wallet.
To test the payment process, execute a payment as usual. When making the payment, select the YooMoney wallet and click Pay in the payment form which is going to open. The payment will be completed successfully.
If you use the YooMoney widget integration scenario, only payments via bank cards will be available in the payment form. The YooMoney wallet will also be displayed in the form but it won't be available for payments.
Testing autopayments
You can test both successful and unsuccessful payments via bank cards but only successful payments via the YooMoney wallet.
Successful scenario
Test the successful scenario of saving a payment method and processing a payment via the saved method.
You don't need a test wallet to test payments via the YooMoney wallet. When testing payments via bank cards, use test bank cards without 3-D Secure authentication, for example:
5555
5555
5555
4444
(Mastercard).Unsuccessful scenarios
Test unsuccessful scenarios on each stage of processing autopayments.
Unsuccessful scenario when saving the payment method
You can test the scenario in which the payment is unsuccessful when the payment method is saved. For example, if there's not enough money on the card.
To do it, use the test bank cards prepared for these purposes when processing the payment.
Unsuccessful scenario when making a payment via the saved payment method
You can test the scenario in which the payment method is saved successfully but if you repeat the payment, it doesn't go through.
To do it, process a payment where the payment method is saved using a test card. After that, use the ID of the saved method to repeat the payment. The payment via the saved method will be unsuccessful because there isn't enough money on the card.
insufficient_funds
will be specified in the payment object as the reason why the payment was canceled.Use the following test bank cards to test this scenario:
5555
5555
5555
4642
(Mastercard)4000
0000
0000
0002
(Visa)2200
0000
0000
0079
(Mir)
Working with receipts in accordance with 54-FZ
Только для тех, кто работает по 54-ФЗ и использует стороннюю онлайн-кассу.
You can test the payment process in accordance with 54-FZ in the demo store. The interaction with YooMoney in the testing mode is the same as during real payments and refunds: you will need to send data for generating receipts, and you can check the receipt information in your Merchant Profile.
While in receipt-testing mode, YooMoney only imitates the interaction with an online sales register: testing data isn’t being sent to the online sales register and OFD, so no physical receipts are being generated, and the user doesn’t receive emails from YooMoney or receipts from OFD.
How to test the receipt-generating procedure:
- Set up the demo store: navigate to the demo store from your Merchant Profile, activate the receipt-testing mode in the Settings — Online Sales Register section, and select the scenario for sending the data.
- Test the payment and refund procedures in accordance with the selected scenario.
- When you’re ready to accept payments from your real customers, make sure that your real store has the online sales register’s settings.
Testing payments in accordance with 54-FZ
Generation of receipts is a part of the payment and refund processes. Check the sending of receipts on each stage and see how the receipts are recorded in the payment history of the demo store.
When testing, specify the identifier and secret key of the demo store in the requests and use the special test bank card and test wallet for payments.
Make sure that at each stage you’re generating the relevant receipts. They should be generated in accordance with the selected scenario for sending the receipts.
Stage | Simultaneously or Payment after receipt | Receipt after payment |
---|---|---|
Payment creation | Payment receipt | Payment receipt |
Full payment capture | No receipt required | No receipt required |
Partial payment capture | Payment receipt | Refund receipt Payment receipt |
Payment cancellation | Receipt generated automatically | Refund receipt |
Delivery of product after prepayment | Transaction completion receipt | Transaction completion receipt |
Full refund | Receipt generated automatically | Refund receipt |
Partial refund | Refund receipt | Refund receipt |
Checklist for preparing the data for receipts
Correctness of requests
Make sure that you’re correctly sending the data for receipts:
- data is sent in the corresponding request (depends on the scenario for sending the receipts);
- all required parameters are included;
- parameters values are sent in the required formats;
- receipt contains no more than 100 items;
- payment amount corresponds to the total receipt amount (to determine the receipt amount, multiply
quantity
byamount
for each item, then add them up); - all amounts in the receipt are positive.
If something goes wrong, YooMoney will return an error.
Correctness of data
Make sure that the data you’re sending meets the requirements of 54-FZ and the restrictions of online sales registers:
- the
excise
parameter is only specified for the products with the “Excisable goods” payment subject attribute; - a separate receipt is created for products sold on credit: it’s forbidden to have products with the “Loan” payment method attribute in the same receipt as the products with other payment method attributes;
- the
product_code
,country_of_origin_code
,customs_declaration_number
parameters are only specified for products with the “Product”, “Excisable goods”, “Several subjects”, “Other” payment subject attributes.
If something goes wrong, the online sales register won’t generate a receipt: the error information will be shown in the payment history (the demo store will have an imitation of the response from the online sales register). The payment status will depend on the scenario for sending the receipts: for Payment after receipt, YooMoney will cancel the payment and automatically generate the Refund receipt; for other scenarios, the payment will be processed.
See also