![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/job-board.corals.io/vendor/xendit/xendit-php/examples/ |
<?php /** * CardlessCreditExample.php * php version 7.2.0 * * @category Example * @package Xendit/Examples * @author Asoka Wotulo <[email protected]> * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = [ 'customer_id' => '14b4bf47-b97a-4c13-bea9-5b1734a46fd1', 'channel_code' => 'ID_KREDIVO', 'currency' => 'IDR', 'amount' => 6000000, 'order_items' => [ [ 'type' => 'PHYSICAL_PRODUCT', 'reference_id' => '1533', 'name' => 'Mobile Phone', 'net_unit_amount' => 6000000, 'quantity' => 1, 'url' => '<your-url>', 'category' => 'Smartphone' ] ] ]; $payLaterPlan = \Xendit\PayLater::initiatePayLaterPlans($params); var_dump($payLaterPlan); $params = [ 'plan_id' => $payLaterPlan['id'], 'reference_id' => 'order_id_' . time(), 'checkout_method' => 'ONE_TIME_PAYMENT', 'success_redirect_url' => 'https://your-site.com/redirect-success', 'failure_redirect_url' => 'https://your-site.com/redirect-failure', ]; $payLaterCharge = \Xendit\PayLater::createPayLaterCharge($params); var_dump($payLaterCharge); $params = []; // Optional $id = 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b'; $payLaterCharge = \Xendit\PayLater::getPayLaterChargeStatus($id, $params); var_dump($payLaterCharge); $params = []; // Optional $id = 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b'; $payLaterChargeRefundCreate = \Xendit\PayLater::createPayLaterRefund($id, $params); var_dump($payLaterChargeRefundCreate); $params = []; // Optional $charge_id = 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b'; $refund_id = 'plr_2f2aa47f-2764-4b42-8712-c3fb1270b09e'; $payLaterChargeRefund = \Xendit\PayLater::getPayLaterRefund($charge_id, $refund_id, $params); var_dump($payLaterChargeRefund); $params = []; // Optional $charge_id = 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b'; $payLaterChargeRefundList = \Xendit\PayLater::listPayLaterRefund($charge_id, $params); var_dump($payLaterChargeRefundList);