Reference for parameters, methods, and error codes
This reference describes:
Reference of parameters for widget initialization
Description of parameters that must be sent to the instance of the 
YooMoneyCheckoutWidget
class on the payment page for widget initialization.
ParameterTypeMandatoryDescription
confirmation_tokenstringRequiredYooMoney token for initializing the widget. To issue a token, create a payment
return_urlstringOptionalAddress of the page for redirecting the user after the payment is completed. The address must be absolute (with the protocol and website domain specified). Example:
https://example.com/orderid-1111
. If the URL isn't specified, you need to handle the payment process events
error_callback(error) => voidRequiredCallback function that accepts the initialization error code
customizationobjectOptionalPayment form customization. Right now, you can customize the color scheme, set up the way, how the widget is displayed and the display of payment methods.
modalbooleanOptional
Sent in 
customization
.
Configuring how the widget is displayed. Possible values:
  • true
     — the payment form is displayed in a pop-up window;
  • false
     — the payment form should be posted on the payment page.
colorsobjectOptionalSent in 
customization
.
Color scheme customization. Colors that must be changed in the payment form’s interface are sent in the object
payment_methodsarrayOptional
Sent in 
customization
.
Configuration of display of payment methods. Possible values:
  • bank_card
     — bank card;
  • yoo_money
     — YooMoney (wallet, linked cards, and bonus points);
  • sberbank
     — SberPay;
  • sbp
     — FPS (Faster Payments System).
If you’d like to configure how payment methods are displayed, contact your YooMoney manager.
Reference for color scheme configuration parameters
Description of all parameters in the 
colors
object that can be used for configuring the color scheme.
ParameterDescriptionDefault
control_primary
Background color for accent elements: the Pay button, selected radio buttons, checkboxes, border of the selected text field. We recommend using a bright color to draw attention
#FFCC00
(yellow)
control_primary_content
Color of the text in the Pay button and the contents of accent radio buttons and checkboxes (for example, a ticked checkbox). We recommend using a color that will contrast with
control_primary
.
If the parameter is not specified, the color will be determined on the basis of 
control_primary
#000000
(black) или
#FFFFFF
(white) — selected to contrast with
control_primary
backgroundPayment form background color, color of error messages and tips. We recommend using a color close to the background color of the container where the widget is placed
#FFFFFF
(white)
text
Color of all texts on the payment form except for the text in the Pay button and tooltips.
If the parameter is not specified, the color is determined on the basis of 
background
Contrast to 
background
borderColor of borders and separators.
If the parameter is not specified, the color is determined on the basis of 
background
Contrast to 
background
control_secondaryColor of non-accent interface elements.
If the parameter is not specified, the color is determined on the basis of 
background
Contrast to 
background
Widget initialization errors
If the widget initialization failed, YooMoney will send an error code to the callback function.
Error codeValue
customization_of_payment_methods_not_allowedThis store can’t use the 
payment_methods
parameter. If you’d like to configure how payment methods are displayed, contact your YooMoney manager.
internal_service_errorError during payment creation. Repeat widget initialization
invalid_combination_of_payment_methodsInvalid combination of payment methods in 
payment_methods
of the 
customization
object. Only one code of the payment method can be sent simultaneously.
invalid_payment_methodsIncorrect
payment_methods
value of the 
customization
object. The array can only contain the codes of the payment methods supported by the widget. If you display several methods, their codes must be presented as a list separated by commas.
invalid_return_urlInvalid return URL. During widget initialization, specify the absolute URL of the payment completion page in 
return_url
with the protocol and domain of your website
invalid_tokenInvalid token. Create a payment to obtain a token
no_payment_methods_to_displayNo payment methods to display: for example, you can’t accept payments via the selected method or the selected payment method can’t be saved for autopayments (if you’re trying to do that). Send another payment method in 
payment_methods
during widget initialization.
token_expiredToken has expired. Create a payment to obtain a new token
token_requiredToken not sent. Send
confirmation_token
during widget initialization
Description of widget’s methods
MethodTypeDescription
render
(id?: string) => Promise<undefined>
Payment form display. Execution of Promise means the payment form is fully loaded. Use of Promise is optional.
If you place the widget on the payment page, specify the value of the 
id
attribute of the container, in which you need to place the payment form, in method’s parameters. If you’d like to display the widget in a pop-up window, you don’t need to specify anything in method’s parameters.
destroy
() => void
Deletion of an initialized widget.
on
(event, callback) => void
Registering widget events and calling the callback function.
Description of the widget events
The widget can notify about following events:
EventDescription
successUser's payment was successful. Used together with
fail
failUser's payment was unsuccessful. Used together with
success
completeUser finished the payment. This event occurs after a successful or unsuccessful payment.
modal_closeUser closed the pop-up window with the payment form. For those who display the widget in a pop-up window.

Do you have any questions or comments regarding the documentation?

We can set up a call and discuss them: we'll help you solve the problem and you'll help us understand what we need to improve. To do that, share your contact information and select the time.
Yes, I'd like to set up a meeting
See also
API ReferenceWidget integrationTypical usage scenarios for the widget