processwith/paywith-php

为PHP应用程序提供简单多支付集成

v0.1-alpha 2020-11-03 13:48 UTC

This package is auto-updated.

Last update: 2024-09-21 01:19:42 UTC


README

paywith repo image

Paywith

Latest Version on Packagist

Paywith使得在您的PHP应用程序中使用多个支付网关变得简单。

安装

您可以通过composer安装此包

composer require processwith/paywith-php

用法

基本交易

use ProcessWith\PayWith;

$paywith = new PayWith('Paystack', 'Your Paystack Secret');
$transaction->initialize([
    'amount' => 5000,
    'email'  => 'jeremiahsucceed@gmail.com',
    'callback_url' => 'https://:3000/tests/verify',
    'currency' => 'NGN'
]);

$transaction->checkout(); // redirect to checkout page

需要更多示例?请查看示例页面。

验证交易

// Paywith must have be initialize with Paystack or Flutterwave 
$transaction = $paywith->transaction();
$transaction->verify( $_GET['reference'] );

if( $transaction->status() )
{
    // check the email and the amount
    // before giving value
    $amount = 5000;
    $email  = 'jeremiah@gmail.com';

    if ( $amount == $transaction->getAmount() && $email == $transaction->getEmail() )
    {
        // give value
        // echo 'thanks for making payment';
    }
}

webhook

// Paywith must have be initialize with Paystack or Flutterwave 
$transaction    = $paywith->transaction();
$transaction->webhook();

if( $transaction->status() )
{
    // check the email and the amount
    // before giving value
    $amount = 5000;
    $email  = 'jeremiah@gmail.com';
    if ( $amount == $transaction->getAmount() && $email == $transaction->getEmail() )
    {
        // give value
        // echo 'thanks for making payment';
    }
}

教程

我们正在制作一些即插即用的教程。如果您想在不热的时候收到一个,请点击这里

变更日志

请查看变更日志以了解最近有什么变化。

贡献

请查看贡献指南以获取详细信息。

安全

如果您发现任何与安全相关的问题,请通过jeremiah@processwith.com发送电子邮件,而不是使用问题跟踪器。

致谢

许可

MIT许可(MIT)。请参阅许可文件以获取更多信息。