If you would like to programmatically pass through an amount, name, or email to a checkout, we allow you to do so by passing a query parameter to the payment form URL.
Name
To pass through a first and last name, you would append:
?name=firstname%20lastname
The "%20" creates a blank space in the field.
The Name field at checkout will be auto-filled with the name you have passed through.
Email
To pass through an email, you would append:
?email=[email protected]
The Email field at checkout will be auto-filled with the email you have passed through.
Amount
To pass through a set amount, you will need to set your form so that the Amount is “Decided at Checkout”. Then, you would append:
?amount_cents=10000
The amount you enter would be the amount you would like to append converted to sub-units of your currency. So, 3000 cents USD would be $30 USD, 4000 cents GBP would be £40 GBP, etc.
Even though the form is set for the amount to be “Decided at Checkout”, if you have passed through an amount, the amount field will not be displayed. Instead, the form will display a set amount.
Combinations
You can pass through a combination of name and/or email and/or amount to a checkout. In order to do so, you would use ampersands when you are appending the data to the URL:
When you pass through combinations, all of the pass-through data will appear on the checkout:
Embeds
If you are using our embed code and embedding a payment form inside your website, you will need to add the query parameters to the "opts" hash in the embed code. Looking inside the embed code, you'll find an opts
object similar to this:
opts={"checkoutToken":"8h7frjfytj","width":"100%"};
You'll need to add the query parameters as follows:
,"amount_cents":3000,"name":"Richard Smith","email":"[email protected]"
Here you can see the entire embed snippet with the updated opts
object::
<div id="mc5mudjto6s6c79"><a href="https://app.moonclerk.com/pay/5mudjto6s6c79">My Checkout</a></div><script type="text/javascript">var mc5mudjto6s6c79;(function(d,t) {var s=d.createElement(t),opts={"checkoutToken":"5mudjto6s6c79","width":"100%","amount_cents":3000,"name":"Richard Smith","email":"[email protected]"};s.src='https://d2l7e0y6ygya2s.cloudfront.net/assets/embed.js';s.onload=s.onreadystatechange = function() {var rs=this.readyState;if(rs) if(rs!='complete') if(rs!='loaded') return;try {mc5mudjto6s6c79=new MoonclerkEmbed(opts);mc5mudjto6s6c79.display();} catch(e){}};var scr=d.getElementsByTagName(t)[0];scr.parentNode.insertBefore(s,scr);})(document,'script');</script>