Skip to content

Commit 88ee9df

Browse files
authored
Create README.md
1 parent db3dad0 commit 88ee9df

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Omnipay - EveryPay Gateway
2+
3+
*Disclaimer: This package is **not** an official package by EveryPay AS nor by omnipay.*
4+
5+
[EveryPay](https://every-pay.com/) is an Estonian payment provider, currently working with LHV and SEB banks.
6+
7+
The package currently supports a limited set of essential features:
8+
9+
- Charging through Gateway API
10+
- Requesting card tokens
11+
12+
**WARNING:** Not production ready yet!
13+
14+
- [ ] Add production endpoints
15+
- [ ] Fix remaining todos
16+
17+
## Usage
18+
19+
### Initialize the gateway
20+
21+
```php
22+
$gateway = Omnipay::create('EveryPay')->initialize([
23+
'username' => '', // EveryPay api username
24+
'secret' => '', // EveryPay api secret
25+
'accountId' => '', // merchant account ID
26+
'testMode' => true, // production mode is not yet supported. coming soon!
27+
'locale' => 'en', // et=Estonian, see integration guide for more options.
28+
]);
29+
```
30+
31+
### Process a purchase
32+
```php
33+
$purchase = $gateway
34+
->purchase(['amount' => $amount])
35+
->setClientIp($_SERVER['REMOTE_ADDR']) // optional, helps fraud detection
36+
->setEmail('') // optional, helps fraud detection
37+
->setCallbackUrl($callbackUrl) // payment callback where payment result will be sent (with PUT)
38+
->setCustomerUrl($callbackUrl); // the url to redirect if the payment fails or gets cancelled
39+
40+
41+
// Uncomment if you want to store the card as a token after the payment
42+
// $purchase->setSaveCard(true);
43+
44+
// Uncomment if you want to make the payment using a previously stored card token
45+
// $purchase->setCardReference($token);
46+
47+
$response = $purchase->send();
48+
49+
// IMPORTANT: Store this payment data somewhere so that we can validate / process it later
50+
$payment = $response->getData();
51+
52+
return $response->redirect(); // this will return a self-submitting html form to EveryPay Gateway API
53+
```
54+
55+
56+
### Complete Payment
57+
58+
EveryPay will return to your callback url with a `PUT` request once the payment is finalized.
59+
You need to validate this response and check if the payment succeeded.
60+
61+
```php
62+
// Here, pass the payment array that we previously stored when creating the payment
63+
$response = $gateway->completePurchase(['payment' => $payment])->send();
64+
65+
if (!$response->isSuccessful()) {
66+
// Payment failed!
67+
// Check $response->getMessage() for more details.
68+
}
69+
70+
// Payment succeeded!
71+
// Here's your payment reference number: $response->getTransactionReference()
72+
73+
if ($card = $response->getCardToken()) {
74+
// You also got back a card token
75+
// Store this somewhere safe for future use!
76+
}
77+
```

0 commit comments

Comments
 (0)