{"id":22941772,"url":"https://github.com/zacksleo/omnipay-99bill","last_synced_at":"2025-08-12T21:32:24.192Z","repository":{"id":57089030,"uuid":"127135260","full_name":"zacksleo/omnipay-99bill","owner":"zacksleo","description":"💳 快钱支付SDK：99bill driver for the Omnipay PHP payment processing library","archived":false,"fork":false,"pushed_at":"2019-07-30T14:53:25.000Z","size":24,"stargazers_count":6,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-29T03:51:43.054Z","etag":null,"topics":["99bill","kuaiqian","omnipay","omnipay-99bill","payment"],"latest_commit_sha":null,"homepage":"https://www.99bill.com/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zacksleo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-28T12:15:25.000Z","updated_at":"2023-11-11T05:09:45.000Z","dependencies_parsed_at":"2022-08-20T16:00:35.129Z","dependency_job_id":null,"html_url":"https://github.com/zacksleo/omnipay-99bill","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Fomnipay-99bill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Fomnipay-99bill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Fomnipay-99bill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Fomnipay-99bill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zacksleo","download_url":"https://codeload.github.com/zacksleo/omnipay-99bill/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229710708,"owners_count":18111640,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["99bill","kuaiqian","omnipay","omnipay-99bill","payment"],"created_at":"2024-12-14T13:44:59.455Z","updated_at":"2024-12-14T13:44:59.976Z","avatar_url":"https://github.com/zacksleo.png","language":"PHP","funding_links":[],"categories":["电子商务( E-commerce )"],"sub_categories":[],"readme":"# omnipay-99bill\n\n99bill driver for the Omnipay PHP payment processing library:  快钱支付SDK\n\n## Quick Start  快速开始\n\n[Omnipay](https://github.com/omnipay/omnipay) is a framework agnostic, multi-gateway payment\nprocessing library for PHP 5.3+. This package implements WechatPay support for Omnipay.\n\n### Install 安装\n\nOmnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it\nto your `composer.json` file:\n\n```shell\n\n$ composer require zacksleo/omnipay-99bill -vvv\n\n```\n\n### Purchase 发起支付\n\n```php\n/* @var \\Omnipay\\Bill99\\Gateway $gateway */\n$gateway = \\Omnipay\\Omnipay::create('Bill99');\n$gateway-\u003esetPrivateKey('the_app_private_key'); //私钥内容\n$gateway-\u003esetReturnUrl('https://www.example.com/return');\n$gateway-\u003esetNotifyUrl('https://www.example.com/return');\n$gateway-\u003esetMchId('merchatn-id'); //商户号\n$request = $gateway-\u003epurchase([\n    //支付人姓名,可以为空。\n    'payerName' =\u003e '',\n    //支付人联系类型，1 代表电子邮件方式；2 代表手机联系方式。可以为空。\n    'payerContactType' =\u003e 1,\n    //支付人联系方式，与payerContactType设置对应，payerContactType为1，则填写邮箱地址；payerContactType为2，则填写手机号码。可以为空。\n    'payerContact' =\u003e '2532987@qq.com',\n    //商户订单号，以下采用时间来定义订单号，商户可以根据自己订单号的定义规则来定义该值，不能为空。\n    'orderId' =\u003e date('YmdHis') . mt_rand(1000, 9999),\n    //订单金额，金额以“分”为单位，商户测试以1分测试即可，切勿以大金额测试。该参数必填。    \n    'orderAmount' =\u003e 1,\n    //商品名称，可以为空。\n    'productName' =\u003e 'product-name',\n    //商品数量，可以为空。\n    'productNum' =\u003e '',\n    //商品代码，可以为空。\n    'productId' =\u003e '55558888',\n    //商品描述，可以为空。\n    'productDesc' =\u003e '',\n    //扩展字段1，商户可以传递自己需要的参数，支付完快钱会原值返回，可以为空。\n    'ext1' =\u003e '',\n    //扩展自段2，商户可以传递自己需要的参数，支付完快钱会原值返回，可以为空。\n    'ext2' =\u003e '',\n]);\n/* @var \\Omnipay\\Bill99\\Message\\PurchaseResponse $response */\n$response = $request-\u003esend();\n$response-\u003eredirect();\nexit;\n```\n\n### 处理支付回调\n\n```php\n/* @var \\Omnipay\\Bill99\\Gateway $gateway */\n$gateway = Omnipay::create('Bill99');\n$gateway-\u003esetPrivateKey('the_app_private_key'); //私钥内容\n$gateway-\u003esetReturnUrl('https://www.example.com/return');\n$gateway-\u003esetNotifyUrl('https://www.example.com/return');\n/**\n * 先从快钱下载好.cer文件(假设为certificate.cer)，然后使用以下命令生成pem文件，里面即为public key(certificate_publickey.pem)\n * openssl x509 -inform PEM -in certificate.cer -pubkey -noout \u003e certificate_publickey.pem\n * @see https://stackoverflow.com/questions/28060159/how-to-extract-the-rsa-public-key-from-a-cer-and-store-it-in-a-pem-using-opens \n */\n$gateway-\u003esetBill99PublicKey('99bill_publickey'); //从快钱下载并提取出的public key\n/* @var $request \\Omnipay\\Bill99\\Message\\CompletePurchaseRequest */\n$request = $gateway-\u003ecompletePurchase();\n$request-\u003esetParams(array_merge($_GET));\ntry {\n    /* @var $response \\Omnipay\\Bill99\\Message\\CompletePurchaseResponse */\n    $response = $request-\u003esend();\n    if ($response-\u003eisPaid()) {\n        $data = $response-\u003egetData();        \n        /**\n         * var_dump($data);\n         * @todo 这里为支付成功的业务逻辑\n         * $data['orderId']  订单号\n         * 订单金额 $data['orderAmount']/100,\n         * 快钱交易号 $data['dealId'],         \n         */\n        /** 这里需要注意，如果同步回调和同步回调（两者均为GET）在同一处处理，\n         * 需要通过一定方式区分是异步还是同步，两者返回信息不同，如用户登录状态($_SESSION[uid])\n         */\n        //异步回调demo，该返回值为快钱必需\n        die(\"\u003cresult\u003e1\u003c/result\u003e\u003credirecturl\u003e$url\u003c/redirecturl\u003e\");\n        //同步回调\n        // redirect跳转页面...\n    } else {\n       // @todo 支付失败的业务逻辑\n       //异步回调demo，该返回值为快钱必需\n       die(\"\u003cresult\u003e0\u003c/result\u003e\u003credirecturl\u003e$url\u003c/redirecturl\u003e\");\n    }\n} catch (Exception $e) {\n    // @todo 这里为支付异常业务逻辑\n    //异步回调demo，该返回值为快钱必需\n    die(\"\u003cresult\u003e0\u003c/result\u003e\u003credirecturl\u003e$url\u003c/redirecturl\u003e\");\n}\n```\n\n## Advance Config  其他配置\n\n### 配置测试环境\n\n```php\n$gateway-\u003esetTestMode(true); // 测试环境\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacksleo%2Fomnipay-99bill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzacksleo%2Fomnipay-99bill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacksleo%2Fomnipay-99bill/lists"}