paymentspring checkout button
The checkout button is the easiest way to start accepting payments on your website with paymentspring.
Checkout buttons are configurable (see options below), and multiple checkout buttons can be included on a single web page.
Example
To include a button on a page, you will need a checkout form-id. Once you have a form-id, paste this javascript into your site where you would like the form to appear:
<script src="https://checkout.paymentspring.com/js/paymentspring.js" formId="cb7eae32763131ade35f" ></script>
Where cb7eae32763131ade35f
is replaced with your form-id.
Options
static amount:
dynamic amount:
recurring checkbox:
optional additional donation: (only available to charitable, social service, and religious organizations)
static distribution:
dynamic distribution:
Javascript callback
If you like, you can also specify a Javascript callback to fire upon a transaction being successfully submitted through your button.
Start by creating and then including in global scope your JS callback, which should take, as an argument, the response object:
function myAwesomeCallback(response) {
console.log(response.data.amount_settled);
}
(It’s worth noting that this function is globally available, meaning that anyone can call it by simply opening the console. Don’t use it for anything that needs to be very secure, and instead consider a webhook).
You will then add callback="myAwesomeCallback"
as an attribute of your
script
tag (note that we are passing it as a function, rather than calling
it; note also that you can name this callback whatever you want):
<script
src="https://checkout.paymentspring.com/js/paymentspring.js"
formId="cb7eae32763131ade35f"
callback="myAwesomeCallback"
></script>
The response object we pass into the callback has a success
boolean attribute
as well as a data
attribute, which in turn is a JSON object that matches the
response from our charge a
token endpoint (see the
“Sample Responses” tab).
See it in action below.
Support or Contact
Just getting started with paymentspring, or having a problem? Contact us or checkout our docs!