Skip to content

Commit efaa183

Browse files
author
Swiftmade
authored
Update README.md
1 parent 7dee416 commit efaa183

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

README.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,29 @@ $payment = $response->getData();
5353
return $response->redirect(); // this will return a self-submitting html form to EveryPay Gateway API
5454
```
5555

56+
### Complete Payment (handle Gateway redirect from EveryPay)
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+
```
78+
5679
### Process a purchase (Backend)
5780
```php
5881
$purchase = $gateway
@@ -77,25 +100,4 @@ if ($response->isSuccessful()) {
77100
```
78101

79102

80-
### Complete Payment
81-
82-
EveryPay will return to your callback url with a `PUT` request once the payment is finalized.
83-
You need to validate this response and check if the payment succeeded.
84103

85-
```php
86-
// Here, pass the payment array that we previously stored when creating the payment
87-
$response = $gateway->completePurchase(['payment' => $payment])->send();
88-
89-
if (!$response->isSuccessful()) {
90-
// Payment failed!
91-
// Check $response->getMessage() for more details.
92-
}
93-
94-
// Payment succeeded!
95-
// Here's your payment reference number: $response->getTransactionReference()
96-
97-
if ($card = $response->getCardToken()) {
98-
// You also got back a card token
99-
// Store this somewhere safe for future use!
100-
}
101-
```

0 commit comments

Comments
 (0)