定制 starkpay/omnipay 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

starkpay/omnipay

最新稳定版本:v0.0.4

Composer 安装命令:

composer require starkpay/omnipay

包简介

Stark driver for the Omnipay payment processing library

README 文档

README

Stark driver for the Omnipay PHP payment library

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP. This package implements Stark support for Omnipay so you can accept crypto currency payments.

Installation

Omnipay is installed via Composer. To install, simply require league/omnipay and starkpay/omnipay with Composer:

composer require league/omnipay starkpay/omnipay

Basic Usage

This package provide Stark Payment Solution.

For general usage instructions, please see the main Omnipay repository.

Basic purchase example

API key will be available in your Stark Merchant Console. Visit : (https://dashboard.starkpayments.net/)

$gateway = \Omnipay\Omnipay::create('Stark');  
$gateway->setApiKey('key_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM');

$response = $gateway->purchase(
    [
        "amount" => "10.00",
        "currency" => "EUR",
        "description" => "My first Payment",
        "returnUrl" => "https://webshop.example.org/return-page.php"
    ]
)->send();

// Process response
if ($response->isSuccessful()) {

    // Payment was successful
    print_r($response);

} elseif ($response->isRedirect()) {
    // You can get Transaction id by  $response->getTransactionId();
    // Redirect to offsite payment gateway
    $response->redirect();

} else {

    // Payment failed
    echo $response->getMessage();
}

Purchase example with Customer

$gateway = \Omnipay\Omnipay::create('Stark');
$gateway->setApiKey('key_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM');

$response = $gateway->purchase(
    [
        "amount" => "10.00",
        "currency" => "EUR",
        "description" => "My first Payment",
        "returnUrl" => "https://webshop.example.org/return-page.php",
        'metadata' => array(
            'customer' => array(
                'name' => 'Customer Full name',
                'email' => 'customeremail@email.com',
                'verified' => true,
            )
        )
    ]
)->send();

// Process response
if ($response->isSuccessful()) {
    // Payment was successful
    print_r($response);

} elseif ($response->isRedirect()) {
    // You can get Transaction id by  $response->getTransactionId();
    // Redirect to offsite payment gateway
    $response->redirect();

} else {
    // Payment failed
    echo $response->getMessage();
}
Response Page

We will post the transaction id & the status to your returnUrl during purchase. Once the transaction is completed you will get a webhook notification which is configured in dashboard.starkpayments.net

Example Return Page : return-page.php

echo "Your transaction id is : " . $_POST['id'] ." and status is : ".$_POST['status'];

Fetch Transaction Details

Fetch Transaction details using transaction id

$gateway = Omnipay::create('Stark');

$gateway->setApiKey('key_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM');

// Send purchase request
$response = $gateway->fetchTransaction([
    'transactionReference' => '5eb165796a7b7'
])->send();

// Process response
if ($response->isSuccessful()) {
    // Transaction Details
    print_r($response->getMetaData());
    /*
    Sample Response
    Array
    (
        [id] => 5eb165796a7b7
        [amount] => 15.00
        [currency] => USD
        [crypto_amount] => 0.001694
        [crypto] => BTC
        [status] => success
        [customer_name] => John Doe
        [customer_email] => john.doe@mail.com
        [transaction_hash] => 76a3e766bf49b0e36ffcd8636cf546f8a4bf1908e176139fdc42e508ba38a7d7
    )
     */
} else {
    // Get Error Message
    echo $response->getMessage();
}

Payment Status Details

Status Description
processing Payment is under processing
success Successfully verified the crypto payment
failed Payment failed or Cancelled by the customer

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.

统计信息

  • 总下载量: 6.39k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固