2pay-co/2pay-php-sdk

v1.0.2 2022-08-08 08:22 UTC

This package is auto-updated.

Last update: 2025-06-10 14:51:49 UTC


README

2Pay Online Api

Requirements

  • CURL extension

Installation

  1. Install composer:

    $ curl -sS https://getcomposer.org/installer | php

    More info about installation on Linux / Unix / OSX and Windows.

  2. Run the Composer command to install the latest version of SDK:

    php composer.phar require 2pay-co/2pay-php-sdk
  3. Require Composer's autoloader in your PHP script (assuming it is in the same directory where you installed Composer):

    require('vendor/autoload.php');

Usage

Please see examples

demo

use Pay\TwoPay;
use Pay\SecurePay;



$secure_param = new SecurePay();
$secure_param->amount = "3.2";
$secure_param->callbackUrl = "";
$secure_param->currency ="USD";
$secure_param->goodsInfo = "";
$secure_param->note = "test order";
$secure_param->description = "order test";
$secure_param->terminal = "ONLINE";
$secure_param->vendor = "alipay";
$secure_param->ipnUrl = '';
$secure_param->reference = (string)time();
$secure_param->timeout = "120";

$two_pay = new TwoPay("merchant_no", "token");
// $res is json string
$res = $two_pay->SecurePay($secure_param);

var_dump($res);