PHP code example of wozozo / xpayjp-php

1. Go to this page and download the library: Download wozozo/xpayjp-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/ */

    

wozozo / xpayjp-php example snippets




use Payjp\Client;

$payjp = new Client('sk_test_c62fade9d045b54cd76d7036');
// X-Payjp-Direct-Token-Generate 使用する場合
$payjp->setDirectTokenMode(true);

$token = $payjp->tokens->create([
    'card' => [
        'number' => 4242424242424242,
        'exp_month' => 12,
        'exp_year' => 2020
    ]
]);
echo $token . PHP_EOL;
json
{
  "ozo/xpayjp-php": "1.*"
  }
}