Adyen API Library for ruby
Checkout is authenticated via api-key:
adyen.api_key = "AP5XXXXXXXXX"
Checkout SDK is a javascript library which loads an Adyen-hosted iframe into your website. Once loaded, it communicates directly with Adyen, abstracting away all server communication and lowering your PCI compliance load.
The front-end is described here
To perform the initial paymentSession call to Adyen, call its method as below:
response = adyen.checkout.paymentSession('{
"amount": {
"value": 1500,
"currency": "EUR"
},
"countryCode": "US",
"origin": "www.example.com",
"returnUrl": "www.example.com",
"reference": "Merchant Reference",
"merchantAccount": "TestMerchant"
}')
Then send the response to the client-side javascript library to initialize the SDK.
Raw payment method details can be sent directly to Adyen through the Checkout API. For instance, to send raw credit card data you could use a request like the below:
response = adyen.checkout.payments('{
"card": {
"number": "4111111111111111",
"expiryMonth": "8",
"expiryYear": "2018",
"cvc": "737",
"holderName": "John Smith"
},
"amount": {
"value": 1500,
"currency": "EUR"
},
"reference": "YOUR_REFERENCE",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
}')
You can also get a list of payment methods which are available for a given transaction to display a page with custom styling to your shoppers:
response = adyen.checkout.payment_methods('{
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
}')
A successful call to payment_methods will return a list of supported payment methods along with redirect URL's so that you can send your shoppers directly to the issuer's site without losing control of front-end styling / logic.
You can also create a link to Adyen's hosted payment form:response = adyen.checkout.payment_links('{
"amount": {
"value": 1500,
"currency": "EUR"
},
"countryCode": "US",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"reference": "YOUR_REFERENCE"
}')
A successful call to payment_links will return a url, which directs a user to Adyen's hosted payment form.