CreateCheckout options explained.
We released Square Checkout as a way for developers to accept payments without having to deal with a card nonce or building a payment form…
We released Square Checkout as a way for developers to accept payments without having to deal with a card nonce or building a payment form user interface. In this post, we’ll dive deep on the different options available to you when generating a checkout form.
- Access token & location ID These might not seem like “options” per se, but it is an important to make sure that the Square Checkout forms you generate are associated with the correct location, whether it is a sandbox location or not. If you are using a sandbox access token, you’ll see a banner at the top like this:
**idempotency_key** Idempotency is a tool that Square uses to help developers from accidentally charging twice, among other things. Requests made with the same idempotency key will always replay the original results, not do anything new.
**order** The order is describes what items, as well as what amount to display to the buyer during the checkout experience. You can read more about all the fields available to the CreateOrderRequest in the documentation.
**ask_for_shipping_address**If you aren’t delivering goods or services, then you probably don’t need a shipping address, but if you are, setting this field to
truewill display a form that asks for a shipping address like this one:
**pre_populate_shipping_address** This field is pretty similar: if you already have your user’s shipping address, you can pre-populate the address box for it so your user doesn’t have to enter it multiple times.
**merchant_support_email** This is the email a buyer would see after they complete the checkout on the order confirmation page. While this field is optional, showing an email is not. If you don’t set one, then the default one for your account will be used.
`pre_populate_buyer_email If you set this, then your buyers will see an email field like this when checking out:
redirect_urlThis is one of the most important options that you can set *with your checkout form, since it redirects users after the transaction back to your site. The useful transaction details like
transactionIdwill be attached to the url as query parameters. If you don’t set this property, buyers will see a checkout confirmation screen, but never be redirected back to your site.
If you want to see more tips like these, be sure to follow The Corner on Medium!