The PHP SDK supports the international version of payment. Currently only supports the international version of Alipay. Since Alipay's cross-border online payment service currently only supports four types of app, wap, web and customs clearance, this SDK provides three types of cross-border payments: app, wap and web.For details, see International Alipay Official documentation .
Install
1
composer require pudongping/global-pay -vvv
Features
- Naming conventions
- Hide details that developers don’t need to pay attention to
- Complies with PSR specifications and can be easily integrated with various PHP frameworks
- has good documentation, including various example methods and official return results. Document address : https://pudongping.github.io/global-pay-doc
Operating environment
- PHP >= 7.1.3
- Composer
Supported payment methods
Alipay
- Computer payment
- Mobile website payment
- APP payment
method | describe |
---|---|
web | Computer payment |
wap | Mobile website payment |
app | APP payment |
Supported methods
All gateways support the following methods
-
find(array|string $order)
Description: Find order interface
Parameters: or access the data returned by the server. or instance is returned. You can pass The query is successful and the Return: . Alipay Overseas Order Single Query Document For parameters, please refer to parameter in cross-border Alipay; , please pass in the system order number, which corresponds to the$order
When the type isstring
out_trade_no
array
Illuminate\Support\Collection
$collection->toArray()
$collection->all()
$collection->get('field')
-
refund(array $order)
Description: Refund interface
Parameters:< a i=4> Array format, please refer to Alipay overseas refund interface document for refund parameters. Return: The refund is successful and the instance is returned. You can pass or a> access the data returned by the server. or$order
Illuminate\Support\Collection
$collection->toArray()
$collection->all()
$collection->get('field')
-
verify()
Explanation: Verify whether the data returned by the server is legal
Return:Illuminate\Support\Collection
< a i=4> The verification is successful and the instance is returned. You can pass$collection->toArray()
or$collection->all()
or$collection->get('field')
Access the data returned by the server.
Other general methods
-
getExchangeRate()
Description: Get the exchange rate. For details, please seeAlipay’s overseas exchange rate inquiry interface .
Return: If successful, returnIlluminate\Support\Collection
instance, which can be passed$collection->toArray()
or 1. The exchange rate between currencies will change once a day between 9:00 and 11:00 Beijing time; 2. The exchange rate has a daily upper limit for 100 times. (You may need to consider saving the exchange rate through cache to prevent exceptions in the interface, because this SDK does not do caching)Note: access the data returned by the server.$collection->all()
or$collection->get('field')
-
getHbFqCost(float $totalAmount, bool $isShowAll = false, bool $isSellerPercent = false)
Description: Get the installment billing status of Huabei
Parameters:$totalAmount
is the principal amount of the installment,$isShowAll
is whether to display the repayment amount of each installment,$isSellerPercent
meanstrue
means that the merchant bears all the handling fees, andfalse
means the user bears all the handling fees.
Return: If successful, returnIlluminate\Support\Collection
instance, which can be passed$collection->toArray()
or access the data returned by the server.$collection->all()
or$collection->get('field')
Return parameter description
<parameter | meaning |
---|---|
for example | Period |
total_amount | principal |
total_charge | total handling fee |
rate |