Skip to content

gorou-178/crosspay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crosspay

Crosspay is an online payment API wrapper.

Support Online payment

Usage

<?php

require __DIR__ . '/vendor/autoload.php';

use Crosspay\CrossPay;
use Crosspay\exception\CrosspayException;

try {
    $crossPay = new CrossPay([
        'provider' => 'stripe', // or payjp
        'api_key' => 'KEY', // require
        'api_secret' => 'SECRET', // require
        'api_version' => 'API_VERSION' // option
    ]);
    
    $customer = $crossPay->customer()->create([
        'email' => 'test@example.com',
        'source' => 'CARD_TOKEN',
    ]);
    
    $charge = $this->crossPay->charge()->create([
        'customer' => $customer->id(),
        'amount' => 1000,
        'currency' => 'jpy',
        'description' => 'test charge'
    ]);
    
    // credit card last 4 number
    echo $customer->defaultCard()->last4();
    
    // charge customer id
    echo $charge->customerId();
    
} catch (CrosspayException $e) {
    echo $e->getMessage();
}

Testing

Use phpunit and phpdotenv.

$ cp .env.example .env

Set to Api Key and Secret.

STRIPE_KEY=""
STRIPE_SECRET=""
STRIPE_API_VERSION=""

PAYJP_KEY=""
PAYJP_SECRET=""

License

This project is licensed under the terms of the MIT license.

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages