PHP code example of smartpay-co / sdk-php
1. Go to this page and download the library: Download smartpay-co/sdk-php library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
smartpay-co / sdk-php example snippets
$api = new \Smartpay\Api('<YOUR_SECRET_KEY>', '<YOUR_PUBLIC_KEY>')
$payload = [
'items' => [
[
'name' => 'オリジナルス STAN SMITH',
'amount' => 1000,
'currency' => 'JPY',
'quantity' => 1,
],
[
'currency' => 'JPY',
'amount' => 500,
'name' => 'Merchant special discount',
'kind' => 'discount'
],
[
'currency' => 'JPY',
'amount' => 100,
'name' => 'explicit taxes',
'kind' => 'tax'
]
],
'customerInfo' => [
'accountAge' => 20,
'email' => '[email protected] ',
'firstName' => '田中',
'lastName' => '太郎',
'firstNameKana' => 'たなか',
'lastNameKana' => 'たろう',
'address' => [
'line1' => '北青山 3-6-7',
'line2' => '青山パラシオタワー 11階',
'subLocality' => '',
'locality' => '港区',
'administrativeArea' => '東京都',
'postalCode' => '107-0061',
'country' => 'JP',
],
'dateOfBirth' => '1985-06-30',
'gender' => 'male',
],
'shippingInfo' => [
'line1' => '北青山 3-6-7',
'line2' => '青山パラシオタワー 11階',
'subLocality' => '',
'locality' => '港区',
'administrativeArea' => '東京都',
'postalCode' => '107-0061',
'country' => 'JP',
],
'reference' => 'order_ref_1234567',
'successUrl' => 'https://docs.smartpay.co/example-pages/checkout-successful',
'cancelUrl' => 'https://docs.smartpay.co/example-pages/checkout-canceled'
];
$session = $api->checkoutSession($payload);
$session->redirectUrl()
shell
composer install smartpay-co/sdk-php