Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revolut gateway docs #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/addons/shop/gateways.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Instructions are available for the following gateways:
|[Stripe](/addons/shop/gateways/stripe/)|![Yes](/assets/svg/check.svg)|![Yes](/assets/svg/check.svg)|![Yes](/assets/svg/check.svg)||
|[StripeSCA](/addons/shop/gateways/stripe-sca/)|![Yes](/assets/svg/check.svg)|![Yes](/assets/svg/check.svg)|![Yes](/assets/svg/check.svg)||
|[Worldpay](/addons/shop/gateways/worldpay/)|![Yes](/assets/svg/check.svg)|![Yes](/assets/svg/check.svg)||||
|[Revolut](/addons/shop/gateways/revolut/)|![Yes](/assets/svg/check.svg)|![Yes](/assets/svg/check.svg)||||


Tax evidence collection happens for all transactions, but only some gateways enable us to retrieve the country the payment card is registered to.
Expand Down
69 changes: 69 additions & 0 deletions src/addons/shop/gateways/revolut.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: Revolut
nav_groups:
- primary
---

*Gateway slug:* `revolut`


## Settings

In your `perch/config/shop.php` file, add your settings for Revolut Business.

```php
<?php
return [
'gateways' => [
'revolut' => [
'enabled' => true,
'test_mode' => true,
'live' => [
'secret_key' => 'sk_live_ABC123',
'publishable_key' => 'pk_live_ABC123',
],
'test' => [
'secret_key' => 'sk_test_ABC123',
'publishable_key' => 'pk_test_ABC123',
],
],
],
];
?>
```

## Payment flow

Revolut Business is a payment-page gateway process, so the user will be sent off to Revolut's site to enter their card details. The payment flow goes like this:


### Step 1: Initiating checkout

```php
<?php

perch_shop_checkout('revolut']);


?>
```

### Step 2: Shop Payment Button

Then will return to the same page returning a `token` and puts it in a hidden field.At this point a Pay button wil show which pop ups the card field,on the completion of the payment
```php
<?php
if (perch_get('token')) {
$success_url="payment/success.php";
$cancel_url="payment/failure.php";
perch_shop_payment_form('revolut', [
'success_url' => success_url,
'cancel_url' => $cancel_url,
'token' =>perch_get("token")
]);
}
?>
```
### Step 3: Complete Payment
On the $success_url add the complete payment function.
```php <?php perch_shop_revolut_complete_payment(perch_get("id")); ?> ```