Skip to content

Commit fcfc96b

Browse files
author
Colin Rood
authored
Merge pull request #53 from VvanGemert/develop
Added checkout.payment_links call, adding Pay by Link functionality
2 parents 21a6c24 + e12bf1a commit fcfc96b

File tree

7 files changed

+40
-1
lines changed

7 files changed

+40
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ adyen.checkout.version = 50
7777
- payment_methods
7878
- payments
7979
- payments.details
80+
- payment_links
8081

8182
**checkout utility:**
8283
- origin_keys

docs/checkout.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ <h2 id="availablemethods">Available methods</h2>
4141
<li>payments</li>
4242

4343
<li>payments.details</li>
44+
45+
<li>payment_links</li>
4446
</ul>
4547

4648
<h2 id="authentication">Authentication</h2>
@@ -99,7 +101,22 @@ <h2 id="usagecheckoutapi">Usage - Checkout API</h2>
99101

100102
<p>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.</p>
101103

104+
You can also create a link to Adyen's hosted payment form:
105+
106+
<pre><code class="ruby language-ruby">response = adyen.checkout.payment_links('{
107+
"amount": {
108+
"value": 1500,
109+
"currency": "EUR"
110+
},
111+
"countryCode": "US",
112+
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
113+
"reference": "YOUR_REFERENCE"
114+
}')</code></pre>
115+
116+
<p>A successful call to payment_links will return a url, which directs a user to Adyen's hosted payment form.</p>
102117
</section>
118+
119+
103120
<footer>
104121
<p>This project is maintained by <a href="https://github.com/Adyen">Adyen</a></p>
105122
<p><small>Hosted on GitHub Pages &mdash; Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>

lib/adyen/services/checkout.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ def initialize(client, version = DEFAULT_VERSION)
88
service = 'Checkout'
99
method_names = [
1010
:payment_methods,
11-
:payment_session
11+
:payment_session,
12+
:payment_links
1213
]
1314

1415
super(client, version, service, method_names)

spec/checkout_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
# format is defined in spec_helper
111111
test_sets = [
112112
["payment_session", "publicKeyToken", "8115054323780109"],
113+
["payment_links", "url", "https://checkoutshopper-test.adyen.com"],
113114
["payments", "resultCode", "Authorised"]
114115
]
115116

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"amount": {
3+
"currency": "USD",
4+
"value": 1000
5+
},
6+
"countryCode": "US",
7+
"merchantAccount": "TestMerchant",
8+
"reference": "Merchant Reference"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"amount": {
3+
"currency": "USD",
4+
"value": 1000
5+
},
6+
"expiresAt": "2019-12-14T10:05:29Z",
7+
"reference": "Merchant Reference",
8+
"url": "https://checkoutshopper-test.adyen.com"
9+
}

spec/service_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
expect(described_class.action_for_method_name(:origin_keys)).to eq 'originKeys'
2727
expect(described_class.action_for_method_name(:payment_methods)).to eq 'paymentMethods'
2828
expect(described_class.action_for_method_name(:payment_session)).to eq 'paymentSession'
29+
expect(described_class.action_for_method_name(:payment_links)).to eq 'paymentLinks'
2930
expect(described_class.action_for_method_name(:refund)).to eq 'refund'
3031
expect(described_class.action_for_method_name(:store_detail)).to eq 'storeDetail'
3132
expect(described_class.action_for_method_name(:store_detail_and_submit_third_party)).to eq 'storeDetailAndSubmitThirdParty'

0 commit comments

Comments
 (0)