PHP code example of coderity / wallet

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

    

coderity / wallet example snippets


$user = User::find(1);

$user->addCard([
    'cardNumber' => 4242424242424242,
    'expiryMonth' => 12,
    'expiryYear' => 2021,
    'cvc' => 123
]);

$user->addCard([
    'cardNumber' => 4242424242424242,
    'expiryMonth' => 12,
    'expiryYear' => 2021,
    'cvc' => 123
], true);

$user->addCard($token);

$result = $user->generateToken([
    'cardNumber' => 4242424242424242,
    'expiryMonth' => 12,
    'expiryYear' => 2021,
    'cvc' => 123
]);

$token = $result['token'];

$user->cards();

$user->getCard($cardID);

$this->user->charge(100, [
     'cardId' => $cardId
]);

$card = $user->addCard([
    'cardNumber' => 4242424242424242,
    'expiryMonth' => 12,
    'expiryYear' => 2021,
    'cvc' => 123
]);

$this->user->charge(100, [
     'cardId' => $card['cardId']
]);

$this->user->newSubscription('main', 'monthly-10-1')
    ->trialDays(10)
    ->useCard($cardId)
    ->create();

$user->updateDefaultCard($cardId);

$card = $user->getDefaultCard();

$user->deleteCard($cardId);