Skip to main content

Before you start

You’ll need a Dime Payments API token. If you don’t have one yet, see Authentication. You’ll also need a merchant SID — the unique ID for the merchant account you’re processing payments for. You can find it in the dashboard or by calling the List Merchants endpoint.

Install an SDK

Pick your language and install the SDK:
composer require dime-technology/dime-php-sdk

Initialize the client

$dime = new \DimePayments\Sdk\Client('your-api-token');

Make your first charge

Charge a credit card using a stored token:
$txn = $dime->transactions->chargeCard('YOUR_SID', [
    'amount' => 49.99,
    'token'  => 'tok_abc123',
    'email'  => 'customer@example.com',
]);

echo $txn->transactionStatus; // "Success"

Tokenize a card first

If you don’t have a token yet, tokenize a card before charging:
$token = $dime->transactions->tokenizeCard('YOUR_SID', [
    'cardholder_name' => 'John Doe',
    'card_number'     => '4111111111111111',
    'expiration_date' => '01/2027',
    'cvv'             => '123',
    'billing_address' => ['zip' => '30009'],
])->token;

// Now charge it
$txn = $dime->transactions->chargeCard('YOUR_SID', [
    'amount' => 49.99,
    'token'  => $token,
]);

What’s next