PHP code example of deepayment / sdk

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

    

deepayment / sdk example snippets


use Deepayment\Sdk\ApiException;
use Deepayment\Sdk\Client;
use Deepayment\Sdk\RequestException;
use Deepayment\Sdk\ResponseException;
use Deepayment\Sdk\TransportException;

$client = new Client([
    'baseUrl' => 'https://panama.deepayment.com',          // production origin; no /api/v1
    'accessKey' => 'mak_live_xxx',
    'merchantPrivateKeyBase64' => $merchantPrivateKey,        // merchant Ed25519 private key, base64
    'platformBodyKeyId' => 'body_20260827_01',
    'platformBodyPublicKeyBase64' => $platformBodyPublicKey,  // platform X25519 public key, base64
    'platformWebhookPublicKeys' => [                          // keyId -> platform Ed25519 public key, base64
        'pwhk_20260827_01' => $platformWebhookPublicKey,
    ],
]);

$order = $client->createPayment([
    'merchantOrderNo' => 'M20260101001',
    'currency' => 'BRL',
    'amount' => '100.00',                              // decimal string, never a float
    'paymentMethod' => ['code' => 'PIX', 'pix' => ['payerName' => 'Joao Silva']],
    'webhookUrl' => 'https://merchant.example/webhook/payments',
]);
echo $order['orderNo'], ' ', $order['status'], ' ', $order['action']['url'] ?? '';

php tests/run.php