Smartpay checkout integration
Explore a full, working code sample of an integration with Smartpay Checkout. The server-side code creates a Smartpay order and redirects to a prebuilt checkout page hosted by Smartpay.
To download a full working project visit our examples GitHub repo
If you would like to know how Smartpay payment works, please see the checkout flow for more details.
Server side code
Follow the guide bellow to create you server side integration.
Client side code
Now all you need to do is call create-smartpay-checkout
anytime a shopper would like to pay using Smartpay.
You can use the following simple example for testing.
<!DOCTYPE html>
<html>
<head>
<link href="./demo.css" rel="stylesheet" />
</head>
<body>
<form method="POST" action="http://127.0.0.1:5000/create-smartpay-checkout">
<button id="checkout" type="submit">Checkout</button>
</form>
</body>
</html>
Testing
We aim to provide the smoothest developer experience, hence we make it straightforward for you to test your integration.
When testing, please use your test API keys to create a checkout session and launch Smartpay checkout (for further details on authenticating your API requests see Authentication ). In test mode the payment is not processed by card networks or payment providers. It enables you to feel safe working on the integration without having to worry about actually being charged.
Test mode checkout will show a テスト中 banner on the top left corner so you can easily verify you are using test mode.
Test consumer account
To complete a test mode checkout you need a test user account. Please follow the instructions below to sign up as a test user to Smartpay.
Email address
Once you are redirected to Smartpay checkout, all you need to do is to use any email with a +test
suffix, e.g. [email protected]
to sign up, and it will immediately be regarded as a test account.
Phone number
When prompted for a phone number please provide a valid Japanese mobile number.
Smartpay verifies the shoppers' phone number by sending a one time password via SMS to the phone number specified during sign up. For test accounts however this one time password is not sent via SMS, it is already pre-filled for you on the form.
Card number
Your test Smartpay account will come with pre-configured card numbers so you can test all the different outcomes:
- Success:
4242 4242 4242 4242
- Hard decline:
4100 0000 0000 0019
- Soft decline:
4000 0000 0000 0119
For test consumers you will not be able to add your own card or use Apple Pay or Google Pay.
Updated 5 months ago