Skip to content

Commit 24763d9

Browse files
committed
Issue #41 Some simple notes on Accept.JS
1 parent e090a13 commit 24763d9

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,46 @@ The following gateways are provided by this package:
3636
* AuthorizeNet_SIM
3737
* AuthorizeNet_DPM
3838

39+
In addition, `Accept.JS` is supported by the AIM driver. More details are provided below.
40+
3941
For general usage instructions, please see the main [Omnipay](https://github.com/thephpleague/omnipay)
4042
repository.
4143

44+
## Accept.JS
45+
46+
This gateway uses a JacaScript script to tokenize credit card details at the front end,
47+
i.e. in the payment form.
48+
Just the tokenized version of the credit card is then sent back to the merchant site,
49+
where it is used as a proxy for the credit card.
50+
51+
The card is tokenized into two values returned in `opaqueData` object from Accept.JS:
52+
53+
* dataDescriptor - the type of opaque data, e.g. "COMMON.ACCEPT.INAPP.PAYMENT"
54+
* dataValue - the value for the opaque data, e.g. "eyJjb2RlIjoiNT... {256 characters} ...idiI6IjEuMSJ9"
55+
56+
These two values must be POSTed back to the merchant application, usually as a part of the payment form.
57+
Make sure the raw credit card details are NOT posted back to your site.
58+
How this is handled is beyond this short note, but examples are always welcome in the documentation.
59+
60+
On the server, the tokenized detailt are passed into the `payment` or `authorize` request object.
61+
You will still need to pass in the `CreditCard` object, as that contains details of the payee and
62+
recipient, but just leave the credit card details of that object blank. For example:
63+
64+
```php
65+
// $gateway is an instantiation of the AIM driver.
66+
// $dataDescriptor and $dataValue come from the paymentr form at the front end.
67+
68+
$request = $gateway->purchase(
69+
[
70+
'notifyUrl' => '...',
71+
'amount' => $amount,
72+
'opaqueDataDescriptor' => $dataDescriptor,
73+
'opaqueDataValue' => $dataValue,
74+
...
75+
]
76+
);
77+
```
78+
4279
## Support
4380

4481
If you are having general issues with Omnipay, we suggest posting on

0 commit comments

Comments
 (0)