Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9db7219

Browse files
Added doc
1 parent ab5135d commit 9db7219

File tree

2 files changed

+224
-0
lines changed

2 files changed

+224
-0
lines changed

‎docs/Domestic.md‎

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
Domestic Gateway
2+
-------------------
3+
4+
Để nắm sơ lược về khái niệm và cách sử dụng các **Omnipay** gateways bạn hãy truy cập vào [đây](https://omnipay.thephpleague.com/)
5+
để kham khảo.
6+
7+
## Khởi tạo gateway:
8+
9+
```php
10+
use Omnipay\Omnipay;
11+
12+
$gateway = Omnipay::create('OnePay_Domestic');
13+
$gateway->setVpcMerchant('Do OnePay cấp');
14+
$gateway->setVpcAccessCode('Do OnePay cấp');
15+
$gateway->setVpcUser('Do OnePay cấp');
16+
$gateway->setVpcPassword('Do OnePay cấp');
17+
$gateway->setVpcHashKey('Do OnePay cấp');
18+
```
19+
20+
Gateway khởi tạo ở trên dùng để tạo các yêu cầu xử lý đến OnePay hoặc dùng để nhận yêu cầu do OnePay gửi đến.
21+
22+
## Tạo yêu cầu thanh toán:
23+
24+
```php
25+
$response = $gateway->purchase([
26+
'vpc_MerchTxnRef' => microtime(false),
27+
'vpc_ReturnURL' => 'https://github.com/phpviet',
28+
'againLink' => 'https://github.com/phpviet',
29+
'vpc_TicketNo' => '127.0.0.1',
30+
'vpc_Amount' => '200000',
31+
'vpc_OrderInfo' => 456,
32+
])->send();
33+
34+
if ($response->isRedirect()) {
35+
$redirectUrl = $response->getRedirectUrl();
36+
37+
// TODO: chuyển khách sang trang OnePay để thanh toán
38+
}
39+
```
40+
41+
Kham khảo thêm các tham trị khi tạo yêu cầu và MoMo trả về tại [đây](https://mtf.onepay.vn/developer/resource/documents/docx/quy_trinh_tich_hop-noidia.pdf).
42+
43+
## Kiểm tra thông tin `vpc_ReturnURL` khi khách được OnePay redirect về:
44+
45+
```php
46+
$response = $gateway->completePurchase()->send();
47+
48+
if ($response->isSuccessful()) {
49+
// TODO: xử lý kết quả và hiển thị.
50+
print $response->vpc_Amount;
51+
print $response->vpc_MerchTxnRef;
52+
53+
var_dump($response->getData()); // toàn bộ data do OnePay gửi sang.
54+
55+
} else {
56+
57+
print $response->getMessage();
58+
}
59+
```
60+
61+
Kham khảo thêm các tham trị khi MoMo trả về tại [đây](https://mtf.onepay.vn/developer/resource/documents/docx/quy_trinh_tich_hop-noidia.pdf).
62+
63+
## Kiểm tra thông tin `IPN` do OnePay gửi sang:
64+
65+
```php
66+
$response = $gateway->notification()->send();
67+
68+
if ($response->isSuccessful()) {
69+
// TODO: xử lý kết quả và hiển thị.
70+
print $response->vpc_Amount;
71+
print $response->vpc_MerchTxnRef;
72+
73+
var_dump($response->getData()); // toàn bộ data do MoMo gửi sang.
74+
75+
} else {
76+
77+
print $response->getMessage();
78+
}
79+
```
80+
81+
Kham khảo thêm các tham trị khi MoMo gửi sang tại [đây](https://mtf.onepay.vn/developer/resource/documents/docx/quy_trinh_tich_hop-noidia.pdf).
82+
83+
## Kiểm tra trạng thái giao dịch:
84+
85+
```php
86+
$response = $gateway->queryTransaction([
87+
'vpc_MerchTxnRef' => '123',
88+
])->send();
89+
90+
if ($response->isSuccessful()) {
91+
// TODO: xử lý kết quả và hiển thị.
92+
93+
var_dump($response->getData()); // toàn bộ data do MoMo gửi về.
94+
95+
} else {
96+
97+
print $response->getMessage();
98+
}
99+
```
100+
101+
Kham khảo thêm các tham trị khi tạo yêu cầu và MoMo trả về tại [đây](https://mtf.onepay.vn/developer/resource/documents/docx/quy_trinh_tich_hop-noidia.pdf).
102+
103+
## Phương thức hổ trợ debug:
104+
105+
Một số phương thức chung hổ trợ debug khi `isSuccessful()` trả về `FALSE`:
106+
107+
```php
108+
print $response->getCode(); // mã báo lỗi do OnePay gửi sang.
109+
print $response->getMessage(); // câu thông báo lỗi do OnePay gửi sang.
110+
```
111+
112+
Kham khảo bảng báo lỗi `getCode()` chi tiết tại [đây](https://mtf.onepay.vn/developer/resource/documents/docx/quy_trinh_tich_hop-noidia.pdf).

‎docs/International.md‎

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
International Gateway
2+
-------------------
3+
4+
Để nắm sơ lược về khái niệm và cách sử dụng các **Omnipay** gateways bạn hãy truy cập vào [đây](https://omnipay.thephpleague.com/)
5+
để kham khảo.
6+
7+
## Khởi tạo gateway:
8+
9+
```php
10+
use Omnipay\Omnipay;
11+
12+
$gateway = Omnipay::create('OnePay_International');
13+
$gateway->setVpcMerchant('Do OnePay cấp');
14+
$gateway->setVpcAccessCode('Do OnePay cấp');
15+
$gateway->setVpcUser('Do OnePay cấp');
16+
$gateway->setVpcPassword('Do OnePay cấp');
17+
$gateway->setVpcHashKey('Do OnePay cấp');
18+
```
19+
20+
Gateway khởi tạo ở trên dùng để tạo các yêu cầu xử lý đến OnePay hoặc dùng để nhận yêu cầu do OnePay gửi đến.
21+
22+
## Tạo yêu cầu thanh toán:
23+
24+
```php
25+
$response = $gateway->purchase([
26+
'vpc_MerchTxnRef' => microtime(false),
27+
'vpc_ReturnURL' => 'https://github.com/phpviet',
28+
'againLink' => 'https://github.com/phpviet',
29+
'vpc_TicketNo' => '127.0.0.1',
30+
'vpc_Amount' => '200000',
31+
'vpc_OrderInfo' => 456,
32+
])->send();
33+
34+
if ($response->isRedirect()) {
35+
$redirectUrl = $response->getRedirectUrl();
36+
37+
// TODO: chuyển khách sang trang OnePay để thanh toán
38+
}
39+
```
40+
41+
Kham khảo thêm các tham trị khi tạo yêu cầu và MoMo trả về tại [đây](https://mtf.onepay.vn/developer/resource/documents/docx/quy_trinh_tich_hop-noidia.pdf).
42+
43+
## Kiểm tra thông tin `vpc_ReturnURL` khi khách được OnePay redirect về:
44+
45+
```php
46+
$response = $gateway->completePurchase()->send();
47+
48+
if ($response->isSuccessful()) {
49+
// TODO: xử lý kết quả và hiển thị.
50+
print $response->vpc_Amount;
51+
print $response->vpc_MerchTxnRef;
52+
53+
var_dump($response->getData()); // toàn bộ data do OnePay gửi sang.
54+
55+
} else {
56+
57+
print $response->getMessage();
58+
}
59+
```
60+
61+
Kham khảo thêm các tham trị khi MoMo trả về tại [đây](https://mtf.onepay.vn/developer/resource/documents/docx/quy_trinh_tich_hop-noidia.pdf).
62+
63+
## Kiểm tra thông tin `IPN` do OnePay gửi sang:
64+
65+
```php
66+
$response = $gateway->notification()->send();
67+
68+
if ($response->isSuccessful()) {
69+
// TODO: xử lý kết quả và hiển thị.
70+
print $response->vpc_Amount;
71+
print $response->vpc_MerchTxnRef;
72+
73+
var_dump($response->getData()); // toàn bộ data do MoMo gửi sang.
74+
75+
} else {
76+
77+
print $response->getMessage();
78+
}
79+
```
80+
81+
Kham khảo thêm các tham trị khi MoMo gửi sang tại [đây](https://mtf.onepay.vn/developer/resource/documents/docx/quy_trinh_tich_hop-noidia.pdf).
82+
83+
## Kiểm tra trạng thái giao dịch:
84+
85+
```php
86+
$response = $gateway->queryTransaction([
87+
'vpc_MerchTxnRef' => '123',
88+
])->send();
89+
90+
if ($response->isSuccessful()) {
91+
// TODO: xử lý kết quả và hiển thị.
92+
93+
var_dump($response->getData()); // toàn bộ data do MoMo gửi về.
94+
95+
} else {
96+
97+
print $response->getMessage();
98+
}
99+
```
100+
101+
Kham khảo thêm các tham trị khi tạo yêu cầu và MoMo trả về tại [đây](https://mtf.onepay.vn/developer/resource/documents/docx/quy_trinh_tich_hop-noidia.pdf).
102+
103+
## Phương thức hổ trợ debug:
104+
105+
Một số phương thức chung hổ trợ debug khi `isSuccessful()` trả về `FALSE`:
106+
107+
```php
108+
print $response->getCode(); // mã báo lỗi do OnePay gửi sang.
109+
print $response->getMessage(); // câu thông báo lỗi do OnePay gửi sang.
110+
```
111+
112+
Kham khảo bảng báo lỗi `getCode()` chi tiết tại [đây](https://mtf.onepay.vn/developer/resource/documents/docx/quy_trinh_tich_hop-noidia.pdf).

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /