hossammonir / hyperpay
MENA地区快速增长企业的全球在线支付标准。
v1.0.2
2023-06-09 16:37 UTC
Requires
- php: ^8.2
README
关于HyperPay
电子支付网关世界级技术 本地专业知识
功能
- COPY&PAY集成。
- 一键结账。
- 令牌化结账。
- 交易报告。
- 结算报告。
- 后台操作[退款 - 反冲]。
安装
composer require hossammonir/hyperpay
发布仓库配置
php artisan vendor:publish --provider="HossamMonir\HyperPay\HyperPayServiceProvider"
这将发布hyperpay.php配置到config/hyperpay.php
准备环境
将以下配置添加到.env文件。
HYPERPAY_TEST_MODE=true #switch to false in production HYPERPAY_CURRENCY="SAR" #default currency HYPERPAY_PAYMENT_TYPE="DB" #default payment type # Live Credentials HYPERPAY_LIVE_ACCESS_TOKEN="your-live-access-token" HYPERPAY_LIVE_VISA_ENTITY="your-live-visa-entity" HYPERPAY_LIVE_MASTERCARD_ENTITY="your-live-mastercard-entity" HYPERPAY_LIVE_MADA_ENTITY="your-live-mada-entity" HYPERPAY_LIVE_APPLEPAY_ENTITY="your-live-applepay-entity" HYPERPAY_LIVE_GOOGLEPAY_ENTITY="your-live-googlepay-entity" # Test Credentials HYPERPAY_TEST_ACCESS_TOKEN="your-test-access-token" HYPERPAY_TEST_VISA_ENTITY="your-test-visa-entity" HYPERPAY_TEST_MASTERCARD_ENTITY="your-test-mastercard-entity" HYPERPAY_TEST_MADA_ENTITY="your-test-mada-entity" HYPERPAY_TEST_APPLEPAY_ENTITY="your-test-applepay-entity" HYPERPAY_TEST_GOOGLEPAY_ENTITY="your-test-googlepay-entity" # Optional ( Merchant Details ) HYPERPAY_COMPANY_NAME="your-company-name" HYPERPAY_COMPANY_STREET1="your-company-street1" HYPERPAY_COMPANY_STREET2="your-company-street2" HYPERPAY_COMPANY_CITY="your-company-city" HYPERPAY_COMPANY_STATE="your-company-state" HYPERPAY_COMPANY_COUNTRY="your-company-country" HYPERPAY_COMPANY_POSTCODE="your-company-postal-code"
用法
准备支付
- 使用基本设置准备结账表单。
use HossamMonir\HyperPay\Facades\HyperPay; use HossamMonir\HyperPay\Enums\HyperPayPaymentMethod; use HossamMonir\HyperPay\Data\Customer; HyperPay::setAmount('100.50') // amount must match ^[0-9]{1,12}(\\.[0-9]{2})?$ ->setMethod(HyperPayPaymentMethod::VISA) ->setCurrency('SAR') ->setTransactionId('123123123') // your should create unique transaction id for each payment ->setCustomer(new Customer( givenName: 'Hossam', surname: 'Monir', mobile: '966500000000', email: 'hey@digitaltunnel.net', // optional merchantCustomerId: '123456789', // optional )) ->basicCheckout();
- 示例响应
{
"response": {
"result": {
"code": "000.200.100",
"description": "successfully created checkout"
},
"buildNumber": "8fa7d731df54352cbb412a410148592d9e5f1ae2@2023-04-13 11:54:02 +0000",
"timestamp": "2023-04-14 02:33:49+0000",
"ndc": "053979FB5110C62F73DB32BBDB4D65C9.uat01-vm-tx04",
"id": "053979FB5110C62F73DB32BBDB4D65C9.uat01-vm-tx04"
},
"props": {
"merchant_transaction_id": "123123123",
"payment_method": "VISA",
"test_mode": true,
"endpoint": "https://eu-test.oppwa.com",
"script_url": "https://eu-test.oppwa.com/v1/paymentWidgets.js?checkoutId=053979FB5110C62F73DB32BBDB4D65C9.uat01-vm-tx04",
"currency": "SAR",
"amount": "100.50",
"status": {
"success": true,
"message": "successfully created checkout"
}
}
}
待续...