PHP code example of bootpay / backend-php
1. Go to this page and download the library: Download bootpay/backend-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/ */
bootpay / backend-php example snippets
composer
Bootpay\ServerPhp\BootpayApi;
BootpayApi::setConfiguration(
'59b731f084382614ebf72215',
'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U='
);
$response = BootpayApi::getAccessToken();
var_dump($response);
$bootpay = BootpayApi::setConfig(
'5b8f6a4d396fa665fdc2b5ea',
'rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw='
);
$response = $bootpay->requestAccessToken();
var_dump($response);
$bootpay = BootpayApi::setConfig(
'5b8f6a4d396fa665fdc2b5ea',
'rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw='
);
$response = $bootpay->requestAccessToken();
$receiptId = '612c31000199430036b5165d';
$response = $bootpay->receiptPayment($receiptId);
var_dump($response);
$bootpay = BootpayApi::setConfig(
'5b8f6a4d396fa665fdc2b5ea',
'rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw='
);
$response = $bootpay->requestAccessToken();
$token = BootpayApi::getAccessToken();
if (!$token->error_code) {
try {
$response = BootpayApi::cancelPayment(
array(
'receipt_id' => '62591cfcd01c7e001c19e259',
'cancel_price' => 1000,
'cancel_tax_free' => '0',
'cancel_id' => null,
'cancel_username' => 'test',
'cancel_message' => '테스트 결제 취소',
'refund' => array(
'bank_account' => '',
'bank_username' => '',
'bank_code' => ''
)
)
);
var_dump($response);
} catch (Exception $e) {
echo($e->getMessage());
}
}
$bootpay = BootpayApi::setConfig(
'5b8f6a4d396fa665fdc2b5ea',
'rm6EYECr6aroQVG2ntW0A6LpWnkTgP4uQ3H18sDDUYw='
);
$response = $bootpay->requestAccessToken();
$token = BootpayApi::getAccessToken();
if (!$token->error_code) {
try {
$response = $bootpay->getSubscribeBillingKey(
'nicepay',
time(),
'30일 정기권 결제',
'카드 번호',
'카드 비밀번호 앞에 2자리',
'카드 만료 연도 2자리',
'카드 만료 월 2자리',
'주민등록번호 또는 사업자번호'
);
var_dump($response);
} catch (Exception $e) {
echo($e->getMessage());
}
}
BootpayApi::setConfiguration(
'59b731f084382614ebf72215',
'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U='
);
$token = BootpayApi::getAccessToken();
if (!$token->error_code) {
try {
$response = BootpayApi::requestSubscribeCardPayment(array(
'billing_key' => '62591a5dd01c7e002219e255',
'order_name' => '테스트결제',
'price' => 1000,
'order_id' => time()
));
} catch (Exception $e) {
echo($e->getMessage());
}
//62591a5dd01c7e002219e255
var_dump($response);
}
BootpayApi::setConfiguration(
'59b731f084382614ebf72215',
'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U='
);
$token = BootpayApi::getAccessToken();
if (!$token->error_code) {
try {
$response = BootpayApi::subscribePaymentReserve(array(
'billing_key' => '[ 빌링키 ]',
'order_name' => '테스트결제',
'price' => 1000,
'order_id' => time(),
'user' => array(
'phone' => '01000000000',
'username' => '홍길동',
'email' => '[email protected] '
),
'reserve_execute_at' => date("Y-m-d H:i:s \U\T\C", time() + 5)
));
} catch (Exception $e) {
echo($e->getMessage());
}
//62591a5dd01c7e002219e255
var_dump($response);
}
BootpayApi::setConfiguration(
'59b731f084382614ebf72215',
'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U='
);
$token = BootpayApi::getAccessToken();
if (!$token->error_code) {
try {
$response = BootpayApi::subscribePaymentReserve(array(
'billing_key' => '[ 빌링키 ]',
'order_name' => '테스트결제',
'price' => 1000,
'order_id' => time(),
'user' => array(
'phone' => '01000000000',
'username' => '홍길동',
'email' => '[email protected] '
),
'reserve_execute_at' => date("Y-m-d H:i:s \U\T\C", time() + 5)
));
if (!$response->error_code) {
$cancel = BootpayApi::cancelSubscribeReserve($response->reserve_id);
var_dump($cancel);
}
} catch (Exception $e) {
echo($e->getMessage());
}
}
BootpayApi::setConfiguration(
'59b731f084382614ebf72215',
'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U='
);
$token = BootpayApi::getAccessToken();
if (!$token->error_code) {
try {
$response = BootpayApi::destroyBillingKey('62591a5dd01c7e002219e255');
} catch (Exception $e) {
echo($e->getMessage());
}
var_dump($response);
}
BootpayApi::setConfiguration(
'59b731f084382614ebf72215',
'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U='
);
$token = BootpayApi::getAccessToken();
if (!$token->error_code) {
$response = BootpayApi::lookupSubscribeBillingKey('6257989ecf9f6d001d0aed1b');
var_dump($response);
}
BootpayApi::setConfiguration(
'59b731f084382614ebf72215',
'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U='
);
$token = BootpayApi::getAccessToken();
if (!$token->error_code) {
try {
$response = BootpayApi::requestUserToken(array(
'user_id' => 'gosomi1',
'phone' => '01012345678'
));
} catch (Exception $e) {
echo($e->getMessage());
}
//62591a5dd01c7e002219e255
var_dump($response);
}
BootpayApi::setConfiguration(
'59b731f084382614ebf72215',
'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U='
);
$token = BootpayApi::getAccessToken();
if (!$token->error_code) {
try {
$response = BootpayApi::confirmPayment('[ receipt_id ]');
var_dump($response);
} catch (Exception $e) {
echo($e->getMessage());
}
}
BootpayApi::setConfiguration(
'59b731f084382614ebf72215',
'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U='
);
$token = BootpayApi::getAccessToken();
if (!$token->error_code) {
try {
$response = BootpayApi::certificate('625783a6cf9f6d001d0aed19');
var_dump($response);
} catch (Exception $e) {
echo($e->getMessage());
}
}
BootpayApi::setConfiguration(
'59b731f084382614ebf72215',
'WwDv0UjfwFa04wYG0LJZZv1xwraQnlhnHE375n52X0U='
);
$token = BootpayApi::getAccessToken();
if (!$token->error_code) {
try {
$response = BootpayApi::shippingStart(
array(
'receipt_id' => "62a95891d01c7e001d7dc20b",
'tracking_number' => '3982983',
'delivery_corp' => 'CJ대한통운',
'user' => array(
'username' => '테스트',
'phone' => '01000000000',
'zipcode' => '099382',
'address' => '서울특별시 종로구'
)
)
);
var_dump($response);
} catch (Exception $e) {
echo($e->getMessage());
}
}