Fields values
Prefill form fields with config option
If you want to prefill fields with some static values, you can use
the paymentFormPrefill config option.
This way you can prefill standard Tamaro fields as well as custom fields.
Prefill form fields with URL query parameters
You can also prefill fields with URL query parameters.
This way you can prefill:
- Tamaro predefined fields:
- purpose
- payment_type
- recurring_interval
- currency
- amount
- payment_method
- stored_is_company_donation
- stored_customer_company
- stored_customer_salutation
- stored_customer_firstname
- stored_customer_lastname
- stored_customer_raw_name
- stored_customer_phone
- stored_customer_email
- stored_customer_birthdate
- stored_customer_pan
- stored_customer_fiscal_code
- stored_customer_email_permission
- stored_customer_message
- stored_customer_donation_receipt
- stored_customer_street
- stored_customer_street_number
- stored_customer_street2
- stored_customer_pobox
- stored_customer_zip_code
- stored_customer_city
- stored_customer_country
- stored_customer_state
- stored_customer_raw_address
- stored_cover_transaction_fee
- chqr_refno
- creditor_reference
 
- Your custom fields (with the names, which start with stored_prefix):- stored_foo
- stored_bar
- stored_customer_foo
- stored_customer_bar
- etc.
 
You need to add rnw- prefix to the query parameter name, so it will look like this:
- rnw-purpose
- rnw-payment_type
- rnw-recurring_interval
- rnw-currency
- rnw-amount
- rnw-payment_method
- rnw-stored_customer_salutation
- rnw-stored_customer_firstname
- rnw-stored_customer_lastname
- rnw-stored_foo
- rnw-stored_bar
- rnw-stored_customer_foo
- rnw-stored_customer_bar
- etc.
Example:
Change form fields values dynamically
You can change form fields values after the widget is created using widget events,
for example afterCreate event:
window.rnw.tamaro.events.afterCreate.subscribe((event) => {
  const tamaro = event.data.api;
  const formData = tamaro.paymentForm.data;
  formData.stored_customer_firstname = 'John';
  formData.stored_customer_lastname = 'Doe';
});
window.rnw.tamaro.runWidget('.rnw-tamaro-widget');
You can override form fields values later at any point by using the widget instance:
window.rnw.tamaro.instance.paymentForm.data.stored_customer_firstname = 'John';
window.rnw.tamaro.instance.paymentForm.data.stored_customer_lastname = 'Doe';