@@ -53,6 +53,29 @@ $payment = $response->getData();
53
53
return $response->redirect(); // this will return a self-submitting html form to EveryPay Gateway API
54
54
```
55
55
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
+
56
79
### Process a purchase (Backend)
57
80
``` php
58
81
$purchase = $gateway
@@ -77,25 +100,4 @@ if ($response->isSuccessful()) {
77
100
```
78
101
79
102
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.
84
103
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