AvalanchePay Express(API) Payment Gateway Documentation


If payer wants to fund payments using AvalanchePay, set payer to AvalanchePay.
Otherwise set payer to Default to use the default payer.
(Other payment method ex: paypal, stripe, coinpayments etc not available yet).


Specify a payment amount and the currency.


It’s a Transaction resource where amount object has to set.


Set the urls where buyer should redirect after transaction is completed or cancelled.


It’s a payment resource where all Payer, Amount, RedirectUrls and Credentials of merchant (Client ID and Client Secret) have to be set. After initialized into Payment object, you need to call the create method. It will generate a redirect URL. Users have to redirect into this URL to complete the transaction.

Installation Instruction :

Using composer

composer require martthewz/avalanche-pay
Or go to GitHub & download: Github Link

Now, go to php-sdk/src/AvalanchePay/Rest/Connection.php, then change BASE_URL value to https://avalanchepay.com

Example :
    require 'vendor/autoload.php';


    use AvalanchePay\Api\Payer;
    use AvalanchePay\Api\Amount;
    use AvalanchePay\Api\Transaction;
    use AvalanchePay\Api\RedirectUrls;
    use AvalanchePay\Api\Payment;

    //Payer Object
    $payer = new Payer();
    $payer->setPaymentMethod('Default'); //Leave as default if you don't know which payment method to use

    //Amount Object
    $amountIns = new Amount();
    $amountIns->setTotal(20)->setCurrency('USD'); //must give a valid currency code and must exist in merchant wallet list

    //Transaction Object
    $trans = new Transaction();

    //RedirectUrls Object
    $urls = new RedirectUrls();
    $urls->setSuccessUrl('http://your-merchant-domain.com/example-success.php') //success url - the merchant domain page,
    to redirect after successful payment, see sample example-success.php file in sdk root
    ->setCancelUrl('http://your-merchant-domain.com/'); //cancel url - the merchant domain page, to redirect after
    cancellation of payment

    //Payment Object
    $payment = new Payment();
    $payment->setCredentials([ //client id & client secret, see merchants->setting(gear icon)
    'client_id' => 'place your client id here', //must provide correct client id of an express merchant
    'client_secret' => 'place your client secret here' //must provide correct client secret of an express merchant

    try {
     $payment->create(); //create payment
     header("Location: ".$payment->getApprovedUrl()); //checkout url
    } catch (\Exception $ex) {
     print $ex;

Optional Instructions

If you don't see changes after configuring the SDK, go to your SDK root and run the commands below:-

composer clear-cache

composer install

composer dump-autoload