mollie_pay 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +426 -0
- data/Rakefile +6 -0
- data/app/controllers/mollie_pay/application_controller.rb +4 -0
- data/app/controllers/mollie_pay/webhook_events_controller.rb +53 -0
- data/app/controllers/mollie_pay/webhooks_controller.rb +20 -0
- data/app/jobs/mollie_pay/application_job.rb +24 -0
- data/app/jobs/mollie_pay/delete_mollie_customer_job.rb +16 -0
- data/app/jobs/mollie_pay/notify_billable_job.rb +17 -0
- data/app/jobs/mollie_pay/process_webhook_event_job.rb +39 -0
- data/app/jobs/mollie_pay/process_webhook_job.rb +56 -0
- data/app/jobs/mollie_pay/refresh_pending_mandate_job.rb +22 -0
- data/app/jobs/mollie_pay/sync_chargebacks_job.rb +19 -0
- data/app/jobs/mollie_pay/sync_subscription_job.rb +18 -0
- data/app/jobs/mollie_pay/sync_subscriptions_job.rb +16 -0
- data/app/models/concerns/mollie_pay/has_uuid.rb +19 -0
- data/app/models/concerns/mollie_pay/syncable.rb +208 -0
- data/app/models/mollie_pay/application_record.rb +45 -0
- data/app/models/mollie_pay/billable.rb +445 -0
- data/app/models/mollie_pay/chargeback.rb +103 -0
- data/app/models/mollie_pay/customer.rb +32 -0
- data/app/models/mollie_pay/mandate.rb +113 -0
- data/app/models/mollie_pay/payment.rb +241 -0
- data/app/models/mollie_pay/refund.rb +61 -0
- data/app/models/mollie_pay/sales_invoice.rb +131 -0
- data/app/models/mollie_pay/subscription.rb +215 -0
- data/config/routes.rb +4 -0
- data/db/migrate/20260315142959_create_mollie_pay_customers.rb +9 -0
- data/db/migrate/20260315143008_create_mollie_pay_mandates.rb +13 -0
- data/db/migrate/20260315143014_create_mollie_pay_subscriptions.rb +15 -0
- data/db/migrate/20260315143020_create_mollie_pay_payments.rb +20 -0
- data/db/migrate/20260315143026_create_mollie_pay_refunds.rb +14 -0
- data/db/migrate/20260315143032_create_mollie_pay_webhook_events.rb +12 -0
- data/db/migrate/20260315143040_add_status_indexes_to_mollie_pay.rb +8 -0
- data/db/migrate/20260315143050_add_checkout_url_to_mollie_pay_payments.rb +5 -0
- data/db/migrate/20260316120000_make_mollie_id_nullable_on_mollie_pay_payments.rb +5 -0
- data/db/migrate/20260317100000_make_webhook_event_mollie_id_unique.rb +6 -0
- data/db/migrate/20260317194500_add_authorized_at_to_mollie_pay_payments.rb +5 -0
- data/db/migrate/20260317194501_add_amount_tracking_to_mollie_pay_payments.rb +9 -0
- data/db/migrate/20260318100000_add_name_to_mollie_pay_subscriptions.rb +12 -0
- data/db/migrate/20260318110000_drop_mollie_pay_webhook_events.rb +19 -0
- data/db/migrate/20260321000001_create_mollie_pay_chargebacks.rb +15 -0
- data/db/migrate/20260326000002_create_mollie_pay_sales_invoices.rb +19 -0
- data/db/migrate/20261115000001_change_mollie_pay_money_to_decimal.rb +38 -0
- data/db/migrate/20261202000001_add_sync_version_to_mollie_pay_tables.rb +13 -0
- data/db/migrate/20261202000002_add_created_at_mollie_to_mollie_pay_payments.rb +5 -0
- data/db/migrate/20261203000001_add_mandate_to_mollie_pay_payments.rb +6 -0
- data/docs/api.md +359 -0
- data/docs/mandates.md +340 -0
- data/docs/request-signing.md +178 -0
- data/docs/testing.md +177 -0
- data/docs/tutorial.md +1340 -0
- data/docs/webhooks.md +231 -0
- data/lib/generators/mollie_pay/install/install_generator.rb +44 -0
- data/lib/generators/mollie_pay/install/templates/initializer.rb.tt +12 -0
- data/lib/mollie/sales_invoice.rb +124 -0
- data/lib/mollie_pay/configuration.rb +101 -0
- data/lib/mollie_pay/engine.rb +31 -0
- data/lib/mollie_pay/errors.rb +12 -0
- data/lib/mollie_pay/request_signature.rb +160 -0
- data/lib/mollie_pay/test_fixtures/customer.json +36 -0
- data/lib/mollie_pay/test_fixtures/payment.json +40 -0
- data/lib/mollie_pay/test_fixtures/payment_billink.json +79 -0
- data/lib/mollie_pay/test_fixtures/payment_with_chargebacks.json +72 -0
- data/lib/mollie_pay/test_fixtures/refund.json +32 -0
- data/lib/mollie_pay/test_fixtures/sales_invoice.json +72 -0
- data/lib/mollie_pay/test_fixtures/subscription.json +48 -0
- data/lib/mollie_pay/test_helper.rb +576 -0
- data/lib/mollie_pay/version.rb +3 -0
- data/lib/mollie_pay/webhook_signature.rb +21 -0
- data/lib/mollie_pay.rb +182 -0
- data/lib/tasks/mollie_pay_tasks.rake +43 -0
- metadata +148 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
require "base64"
|
|
2
|
+
require "digest"
|
|
3
|
+
require "net/http"
|
|
4
|
+
require "openssl"
|
|
5
|
+
|
|
6
|
+
module MolliePay
|
|
7
|
+
# Signs requests to the Mollie API as https://docs.mollie.com/reference/request-signing
|
|
8
|
+
# describes. Once a public key is registered on a Mollie API key or access
|
|
9
|
+
# token, Mollie rejects every unsigned request made with it.
|
|
10
|
+
#
|
|
11
|
+
# mollie-api-ruby builds and sends each request inside
|
|
12
|
+
# Mollie::Client#perform_http_call and offers no hook in between, so the
|
|
13
|
+
# signature is added in Net::HTTP#request, and only for requests sent from
|
|
14
|
+
# inside that call.
|
|
15
|
+
module RequestSignature
|
|
16
|
+
THREAD_KEY = :mollie_pay_request_signing_key
|
|
17
|
+
|
|
18
|
+
module_function
|
|
19
|
+
|
|
20
|
+
def sign!(request, key)
|
|
21
|
+
signed_at = Time.current.utc.iso8601(3)
|
|
22
|
+
signature = key.sign(nil, payload(request, signed_at))
|
|
23
|
+
|
|
24
|
+
request["X-Client-Signed-At"] = signed_at
|
|
25
|
+
request["X-Client-Signature"] = Base64.strict_encode64(signature)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def payload(request, signed_at)
|
|
29
|
+
path, query = request.path.split("?", 2)
|
|
30
|
+
|
|
31
|
+
[
|
|
32
|
+
request.method.downcase,
|
|
33
|
+
path,
|
|
34
|
+
canonical_query(query),
|
|
35
|
+
signed_at,
|
|
36
|
+
request["Idempotency-Key"].to_s,
|
|
37
|
+
Digest::SHA256.hexdigest(request.body.to_s)
|
|
38
|
+
].join("\n")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def canonical_query(query)
|
|
42
|
+
return "" if query.blank?
|
|
43
|
+
|
|
44
|
+
URI.decode_www_form(query)
|
|
45
|
+
.each_with_index.sort_by { |(key, _), index| [ key, index ] }
|
|
46
|
+
.map { |(key, value), _| "#{encode_uri_component(key)}=#{encode_uri_component(value)}" }
|
|
47
|
+
.join("&")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Matches JavaScript's encodeURIComponent, which Mollie's example uses.
|
|
51
|
+
def encode_uri_component(string)
|
|
52
|
+
string.b.gsub(/[^A-Za-z0-9\-_.!~*'()]/n) { |char| format("%%%02X", char.ord) }
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# A new Ed25519 key pair as PEM: the private key for the app, the public
|
|
56
|
+
# key for Mollie.
|
|
57
|
+
def generate_key_pair
|
|
58
|
+
key = OpenSSL::PKey.generate_key("ED25519")
|
|
59
|
+
|
|
60
|
+
[ key.private_to_pem, key.public_to_pem ]
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# The key as the one line of base64 between a PEM's first and last line.
|
|
64
|
+
def single_line(pem)
|
|
65
|
+
pem.lines.reject { |line| line.start_with?("-----") }.join.delete("\n")
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Reads a key from PEM, from PEM with "\n" for its line breaks, or from
|
|
69
|
+
# the single line. Raises OpenSSL::PKey::PKeyError for anything else,
|
|
70
|
+
# a passphrase-protected key included: the empty passphrase keeps OpenSSL
|
|
71
|
+
# from asking for one on the terminal, which would stop the app at boot.
|
|
72
|
+
def read_key(value)
|
|
73
|
+
text = value.to_s.gsub("\\n", "\n").strip
|
|
74
|
+
text = Base64.decode64(text) unless text.include?("-----BEGIN")
|
|
75
|
+
|
|
76
|
+
OpenSSL::PKey.read(text, "")
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def private?(key)
|
|
80
|
+
key.private_to_der.present?
|
|
81
|
+
rescue OpenSSL::PKey::PKeyError
|
|
82
|
+
false
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Asks Mollie how this app's signing stands, with two requests that read
|
|
86
|
+
# and change nothing:
|
|
87
|
+
#
|
|
88
|
+
# :not_configured no request_signing_key is set
|
|
89
|
+
# :not_enforced Mollie accepts an unsigned request, so no public key
|
|
90
|
+
# is registered on the API key
|
|
91
|
+
# :accepted Mollie refuses unsigned requests and accepts ours
|
|
92
|
+
# :refused Mollie refuses unsigned requests and ours too: the
|
|
93
|
+
# registered public key is not this key's, the API key
|
|
94
|
+
# is wrong, or the clock is more than 5 minutes off
|
|
95
|
+
def status
|
|
96
|
+
if MolliePay.configuration.request_signing_private_key.nil?
|
|
97
|
+
:not_configured
|
|
98
|
+
elsif unsigned_request_accepted?
|
|
99
|
+
:not_enforced
|
|
100
|
+
elsif signed_request_accepted?
|
|
101
|
+
:accepted
|
|
102
|
+
else
|
|
103
|
+
:refused
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Sent outside Mollie::Client, so nothing signs it.
|
|
108
|
+
def unsigned_request_accepted?
|
|
109
|
+
request = Net::HTTP::Get.new("/#{Mollie::Client::API_VERSION}/methods")
|
|
110
|
+
request["Authorization"] = "Bearer #{MolliePay.configuration.api_key}"
|
|
111
|
+
request["Accept"] = "application/json"
|
|
112
|
+
endpoint = URI(Mollie::Client::API_ENDPOINT)
|
|
113
|
+
|
|
114
|
+
response = Net::HTTP.start(endpoint.host, endpoint.port, use_ssl: true, open_timeout: 10, read_timeout: 20) { |http| http.request(request) }
|
|
115
|
+
|
|
116
|
+
case response.code
|
|
117
|
+
when "200" then true
|
|
118
|
+
when "401" then false
|
|
119
|
+
else raise MolliePay::Error, "Mollie answered #{response.code} to the unsigned request"
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def signed_request_accepted?
|
|
124
|
+
Mollie::Method.all
|
|
125
|
+
true
|
|
126
|
+
rescue Mollie::RequestError => error
|
|
127
|
+
raise unless error.status == 401
|
|
128
|
+
|
|
129
|
+
false
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Prepended into Mollie::Client.
|
|
133
|
+
module Client
|
|
134
|
+
def perform_http_call(...)
|
|
135
|
+
key = MolliePay.configuration.request_signing_private_key
|
|
136
|
+
return super if key.nil?
|
|
137
|
+
|
|
138
|
+
# WebMock and similar libraries replace Net::HTTP with a subclass, so
|
|
139
|
+
# the signer goes in front of whichever class is current.
|
|
140
|
+
Net::HTTP.prepend(HTTP) unless Net::HTTP.ancestors.take_while { |ancestor| ancestor != Net::HTTP }.include?(HTTP)
|
|
141
|
+
|
|
142
|
+
previous = Thread.current[THREAD_KEY]
|
|
143
|
+
Thread.current[THREAD_KEY] = key
|
|
144
|
+
super
|
|
145
|
+
ensure
|
|
146
|
+
Thread.current[THREAD_KEY] = previous if key
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Prepended into Net::HTTP. Net::HTTP#request calls itself once more when
|
|
151
|
+
# it opens the connection, so a request is signed only once.
|
|
152
|
+
module HTTP
|
|
153
|
+
def request(request, ...)
|
|
154
|
+
key = Thread.current[THREAD_KEY]
|
|
155
|
+
RequestSignature.sign!(request, key) if key && request["X-Client-Signature"].nil?
|
|
156
|
+
super
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"resource": "customer",
|
|
3
|
+
"id": "cst_test1234AB",
|
|
4
|
+
"mode": "test",
|
|
5
|
+
"name": "Test Customer",
|
|
6
|
+
"email": "test@example.com",
|
|
7
|
+
"locale": null,
|
|
8
|
+
"metadata": null,
|
|
9
|
+
"createdAt": "2026-03-15T12:00:00+00:00",
|
|
10
|
+
"_links": {
|
|
11
|
+
"self": {
|
|
12
|
+
"href": "https://api.mollie.com/v2/customers/cst_test1234AB",
|
|
13
|
+
"type": "application/hal+json"
|
|
14
|
+
},
|
|
15
|
+
"dashboard": {
|
|
16
|
+
"href": "https://my.mollie.com/dashboard/org_12345678/customers/cst_test1234AB",
|
|
17
|
+
"type": "text/html"
|
|
18
|
+
},
|
|
19
|
+
"mandates": {
|
|
20
|
+
"href": "https://api.mollie.com/v2/customers/cst_test1234AB/mandates",
|
|
21
|
+
"type": "application/hal+json"
|
|
22
|
+
},
|
|
23
|
+
"subscriptions": {
|
|
24
|
+
"href": "https://api.mollie.com/v2/customers/cst_test1234AB/subscriptions",
|
|
25
|
+
"type": "application/hal+json"
|
|
26
|
+
},
|
|
27
|
+
"payments": {
|
|
28
|
+
"href": "https://api.mollie.com/v2/customers/cst_test1234AB/payments",
|
|
29
|
+
"type": "application/hal+json"
|
|
30
|
+
},
|
|
31
|
+
"documentation": {
|
|
32
|
+
"href": "https://docs.mollie.com/reference/get-customer",
|
|
33
|
+
"type": "text/html"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"resource": "payment",
|
|
3
|
+
"id": "tr_test1234AB",
|
|
4
|
+
"mode": "test",
|
|
5
|
+
"createdAt": "2026-03-15T12:00:00+00:00",
|
|
6
|
+
"amount": {
|
|
7
|
+
"value": "10.00",
|
|
8
|
+
"currency": "EUR"
|
|
9
|
+
},
|
|
10
|
+
"description": "Test payment",
|
|
11
|
+
"method": null,
|
|
12
|
+
"metadata": null,
|
|
13
|
+
"status": "open",
|
|
14
|
+
"isCancelable": false,
|
|
15
|
+
"locale": "nl_NL",
|
|
16
|
+
"expiresAt": "2026-03-15T12:15:00+00:00",
|
|
17
|
+
"profileId": "pfl_TestProfile",
|
|
18
|
+
"customerId": "cst_test1234AB",
|
|
19
|
+
"sequenceType": "oneoff",
|
|
20
|
+
"redirectUrl": "https://example.com/return",
|
|
21
|
+
"webhookUrl": "https://example.com/mollie_pay/webhooks",
|
|
22
|
+
"_links": {
|
|
23
|
+
"self": {
|
|
24
|
+
"href": "https://api.mollie.com/v2/payments/tr_test1234AB",
|
|
25
|
+
"type": "application/hal+json"
|
|
26
|
+
},
|
|
27
|
+
"checkout": {
|
|
28
|
+
"href": "https://www.mollie.com/payscreen/select-method/test1234AB",
|
|
29
|
+
"type": "text/html"
|
|
30
|
+
},
|
|
31
|
+
"dashboard": {
|
|
32
|
+
"href": "https://my.mollie.com/dashboard/org_12345678/payments/tr_test1234AB",
|
|
33
|
+
"type": "text/html"
|
|
34
|
+
},
|
|
35
|
+
"documentation": {
|
|
36
|
+
"href": "https://docs.mollie.com/reference/get-payment",
|
|
37
|
+
"type": "text/html"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"resource": "payment",
|
|
3
|
+
"id": "tr_billink1234AB",
|
|
4
|
+
"mode": "test",
|
|
5
|
+
"createdAt": "2026-10-09T12:00:00+00:00",
|
|
6
|
+
"amount": {
|
|
7
|
+
"value": "121.00",
|
|
8
|
+
"currency": "EUR"
|
|
9
|
+
},
|
|
10
|
+
"description": "Order 1001",
|
|
11
|
+
"method": "billink",
|
|
12
|
+
"metadata": null,
|
|
13
|
+
"status": "authorized",
|
|
14
|
+
"isCancelable": false,
|
|
15
|
+
"authorizedAt": "2026-10-09T12:01:00+00:00",
|
|
16
|
+
"captureMode": "manual",
|
|
17
|
+
"captureBefore": "2026-11-06T12:01:00+00:00",
|
|
18
|
+
"amountCaptured": {
|
|
19
|
+
"value": "0.00",
|
|
20
|
+
"currency": "EUR"
|
|
21
|
+
},
|
|
22
|
+
"amountRemaining": {
|
|
23
|
+
"value": "121.00",
|
|
24
|
+
"currency": "EUR"
|
|
25
|
+
},
|
|
26
|
+
"locale": "nl_NL",
|
|
27
|
+
"profileId": "pfl_TestProfile",
|
|
28
|
+
"customerId": "cst_test1234AB",
|
|
29
|
+
"sequenceType": "oneoff",
|
|
30
|
+
"redirectUrl": "https://example.com/return",
|
|
31
|
+
"webhookUrl": "https://example.com/mollie_pay/webhooks",
|
|
32
|
+
"billingAddress": {
|
|
33
|
+
"givenName": "Jan",
|
|
34
|
+
"familyName": "Jansen",
|
|
35
|
+
"streetAndNumber": "Keizersgracht 126",
|
|
36
|
+
"postalCode": "1015 CW",
|
|
37
|
+
"city": "Amsterdam",
|
|
38
|
+
"country": "NL",
|
|
39
|
+
"email": "jan@example.com"
|
|
40
|
+
},
|
|
41
|
+
"lines": [
|
|
42
|
+
{
|
|
43
|
+
"type": "physical",
|
|
44
|
+
"description": "Widget",
|
|
45
|
+
"quantity": 1,
|
|
46
|
+
"unitPrice": {
|
|
47
|
+
"value": "121.00",
|
|
48
|
+
"currency": "EUR"
|
|
49
|
+
},
|
|
50
|
+
"totalAmount": {
|
|
51
|
+
"value": "121.00",
|
|
52
|
+
"currency": "EUR"
|
|
53
|
+
},
|
|
54
|
+
"vatRate": "21.00",
|
|
55
|
+
"vatAmount": {
|
|
56
|
+
"value": "21.00",
|
|
57
|
+
"currency": "EUR"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"_links": {
|
|
62
|
+
"self": {
|
|
63
|
+
"href": "https://api.mollie.com/v2/payments/tr_billink1234AB",
|
|
64
|
+
"type": "application/hal+json"
|
|
65
|
+
},
|
|
66
|
+
"checkout": {
|
|
67
|
+
"href": "https://www.mollie.com/checkout/select-method/billink1234AB",
|
|
68
|
+
"type": "text/html"
|
|
69
|
+
},
|
|
70
|
+
"dashboard": {
|
|
71
|
+
"href": "https://my.mollie.com/dashboard/org_12345678/payments/tr_billink1234AB",
|
|
72
|
+
"type": "text/html"
|
|
73
|
+
},
|
|
74
|
+
"documentation": {
|
|
75
|
+
"href": "https://docs.mollie.com/reference/get-payment",
|
|
76
|
+
"type": "text/html"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"resource": "payment",
|
|
3
|
+
"id": "tr_test1234AB",
|
|
4
|
+
"mode": "test",
|
|
5
|
+
"createdAt": "2026-03-15T12:00:00+00:00",
|
|
6
|
+
"amount": {
|
|
7
|
+
"value": "10.00",
|
|
8
|
+
"currency": "EUR"
|
|
9
|
+
},
|
|
10
|
+
"description": "Test payment",
|
|
11
|
+
"method": null,
|
|
12
|
+
"metadata": null,
|
|
13
|
+
"status": "paid",
|
|
14
|
+
"isCancelable": false,
|
|
15
|
+
"locale": "nl_NL",
|
|
16
|
+
"expiresAt": "2026-03-15T12:15:00+00:00",
|
|
17
|
+
"profileId": "pfl_TestProfile",
|
|
18
|
+
"sequenceType": "oneoff",
|
|
19
|
+
"redirectUrl": "https://example.com/return",
|
|
20
|
+
"webhookUrl": "https://example.com/mollie_pay/webhooks",
|
|
21
|
+
"customerId": "cst_test1234AB",
|
|
22
|
+
"amountChargedBack": {
|
|
23
|
+
"value": "10.00",
|
|
24
|
+
"currency": "EUR"
|
|
25
|
+
},
|
|
26
|
+
"_embedded": {
|
|
27
|
+
"chargebacks": [
|
|
28
|
+
{
|
|
29
|
+
"resource": "chargeback",
|
|
30
|
+
"id": "chb_ls7ahg",
|
|
31
|
+
"amount": {
|
|
32
|
+
"value": "10.00",
|
|
33
|
+
"currency": "EUR"
|
|
34
|
+
},
|
|
35
|
+
"createdAt": "2026-01-03T13:20:37+00:00",
|
|
36
|
+
"reason": {
|
|
37
|
+
"code": "AM04",
|
|
38
|
+
"description": "Insufficient funds"
|
|
39
|
+
},
|
|
40
|
+
"paymentId": "tr_test1234AB",
|
|
41
|
+
"settlementAmount": {
|
|
42
|
+
"value": "-10.00",
|
|
43
|
+
"currency": "EUR"
|
|
44
|
+
},
|
|
45
|
+
"_links": {
|
|
46
|
+
"self": {
|
|
47
|
+
"href": "https://api.mollie.com/v2/payments/tr_test1234AB/chargebacks/chb_ls7ahg",
|
|
48
|
+
"type": "application/hal+json"
|
|
49
|
+
},
|
|
50
|
+
"payment": {
|
|
51
|
+
"href": "https://api.mollie.com/v2/payments/tr_test1234AB",
|
|
52
|
+
"type": "application/hal+json"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
"_links": {
|
|
59
|
+
"self": {
|
|
60
|
+
"href": "https://api.mollie.com/v2/payments/tr_test1234AB",
|
|
61
|
+
"type": "application/hal+json"
|
|
62
|
+
},
|
|
63
|
+
"checkout": {
|
|
64
|
+
"href": "https://www.mollie.com/payscreen/select-method/test1234AB",
|
|
65
|
+
"type": "text/html"
|
|
66
|
+
},
|
|
67
|
+
"documentation": {
|
|
68
|
+
"href": "https://docs.mollie.com/reference/v2/payments-api/get-payment",
|
|
69
|
+
"type": "text/html"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"resource": "refund",
|
|
3
|
+
"id": "re_test1234AB",
|
|
4
|
+
"mode": "test",
|
|
5
|
+
"amount": {
|
|
6
|
+
"value": "10.00",
|
|
7
|
+
"currency": "EUR"
|
|
8
|
+
},
|
|
9
|
+
"settlementAmount": {
|
|
10
|
+
"value": "-10.00",
|
|
11
|
+
"currency": "EUR"
|
|
12
|
+
},
|
|
13
|
+
"status": "queued",
|
|
14
|
+
"createdAt": "2026-03-15T12:00:00+00:00",
|
|
15
|
+
"description": "Test refund",
|
|
16
|
+
"metadata": null,
|
|
17
|
+
"paymentId": "tr_test1234AB",
|
|
18
|
+
"_links": {
|
|
19
|
+
"self": {
|
|
20
|
+
"href": "https://api.mollie.com/v2/payments/tr_test1234AB/refunds/re_test1234AB",
|
|
21
|
+
"type": "application/hal+json"
|
|
22
|
+
},
|
|
23
|
+
"payment": {
|
|
24
|
+
"href": "https://api.mollie.com/v2/payments/tr_test1234AB",
|
|
25
|
+
"type": "application/hal+json"
|
|
26
|
+
},
|
|
27
|
+
"documentation": {
|
|
28
|
+
"href": "https://docs.mollie.com/reference/get-refund",
|
|
29
|
+
"type": "text/html"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"resource": "sales-invoice",
|
|
3
|
+
"id": "invoice_test1234AB",
|
|
4
|
+
"profileId": "pfl_testXYZ",
|
|
5
|
+
"status": "issued",
|
|
6
|
+
"invoiceNumber": "INV-0000001",
|
|
7
|
+
"recipientIdentifier": "customer-xyz-0123",
|
|
8
|
+
"recipient": {
|
|
9
|
+
"type": "consumer",
|
|
10
|
+
"givenName": "Jane",
|
|
11
|
+
"familyName": "Doe",
|
|
12
|
+
"email": "jane@example.com",
|
|
13
|
+
"streetAndNumber": "Keizersgracht 126",
|
|
14
|
+
"postalCode": "1015 CX",
|
|
15
|
+
"city": "Amsterdam",
|
|
16
|
+
"country": "NL",
|
|
17
|
+
"locale": "nl_NL"
|
|
18
|
+
},
|
|
19
|
+
"lines": [
|
|
20
|
+
{
|
|
21
|
+
"description": "Monthly subscription - Pro plan",
|
|
22
|
+
"quantity": 1,
|
|
23
|
+
"vatRate": "21.00",
|
|
24
|
+
"unitPrice": {
|
|
25
|
+
"currency": "EUR",
|
|
26
|
+
"value": "89.00"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"paymentTerm": "30 days",
|
|
31
|
+
"vatScheme": "standard",
|
|
32
|
+
"vatMode": "exclusive",
|
|
33
|
+
"memo": "Thank you for your business!",
|
|
34
|
+
"isEInvoice": false,
|
|
35
|
+
"subtotalAmount": {
|
|
36
|
+
"currency": "EUR",
|
|
37
|
+
"value": "89.00"
|
|
38
|
+
},
|
|
39
|
+
"discountedSubtotalAmount": {
|
|
40
|
+
"currency": "EUR",
|
|
41
|
+
"value": "89.00"
|
|
42
|
+
},
|
|
43
|
+
"totalVatAmount": {
|
|
44
|
+
"currency": "EUR",
|
|
45
|
+
"value": "18.69"
|
|
46
|
+
},
|
|
47
|
+
"totalAmount": {
|
|
48
|
+
"currency": "EUR",
|
|
49
|
+
"value": "107.69"
|
|
50
|
+
},
|
|
51
|
+
"amountDue": {
|
|
52
|
+
"currency": "EUR",
|
|
53
|
+
"value": "107.69"
|
|
54
|
+
},
|
|
55
|
+
"createdAt": "2026-03-26T10:00:00+00:00",
|
|
56
|
+
"issuedAt": "2026-03-26T10:00:00+00:00",
|
|
57
|
+
"dueAt": "2026-04-25T10:00:00+00:00",
|
|
58
|
+
"_links": {
|
|
59
|
+
"self": {
|
|
60
|
+
"href": "https://api.mollie.com/v2/sales-invoices/invoice_test1234AB",
|
|
61
|
+
"type": "application/hal+json"
|
|
62
|
+
},
|
|
63
|
+
"pdfLink": {
|
|
64
|
+
"href": "https://api.mollie.com/v2/sales-invoices/invoice_test1234AB/pdf",
|
|
65
|
+
"type": "application/pdf"
|
|
66
|
+
},
|
|
67
|
+
"invoicePayment": {
|
|
68
|
+
"href": "https://pay.mollie.com/invoice/test1234AB",
|
|
69
|
+
"type": "text/html"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"resource": "subscription",
|
|
3
|
+
"id": "sub_test1234AB",
|
|
4
|
+
"customerId": "cst_test1234AB",
|
|
5
|
+
"mode": "test",
|
|
6
|
+
"createdAt": "2026-03-15T12:00:00+00:00",
|
|
7
|
+
"status": "active",
|
|
8
|
+
"amount": {
|
|
9
|
+
"value": "25.00",
|
|
10
|
+
"currency": "EUR"
|
|
11
|
+
},
|
|
12
|
+
"description": "Test subscription",
|
|
13
|
+
"method": null,
|
|
14
|
+
"times": null,
|
|
15
|
+
"timesRemaining": null,
|
|
16
|
+
"interval": "1 month",
|
|
17
|
+
"startDate": "2026-04-15",
|
|
18
|
+
"nextPaymentDate": "2026-04-15",
|
|
19
|
+
"webhookUrl": "https://example.com/mollie_pay/webhooks",
|
|
20
|
+
"metadata": null,
|
|
21
|
+
"mandateId": "mdt_test1234AB",
|
|
22
|
+
"_links": {
|
|
23
|
+
"self": {
|
|
24
|
+
"href": "https://api.mollie.com/v2/customers/cst_test1234AB/subscriptions/sub_test1234AB",
|
|
25
|
+
"type": "application/hal+json"
|
|
26
|
+
},
|
|
27
|
+
"mandate": {
|
|
28
|
+
"href": "https://api.mollie.com/v2/customers/cst_test1234AB/mandates/mdt_test1234AB",
|
|
29
|
+
"type": "application/hal+json"
|
|
30
|
+
},
|
|
31
|
+
"customer": {
|
|
32
|
+
"href": "https://api.mollie.com/v2/customers/cst_test1234AB",
|
|
33
|
+
"type": "application/hal+json"
|
|
34
|
+
},
|
|
35
|
+
"payments": {
|
|
36
|
+
"href": "https://api.mollie.com/v2/customers/cst_test1234AB/subscriptions/sub_test1234AB/payments",
|
|
37
|
+
"type": "application/hal+json"
|
|
38
|
+
},
|
|
39
|
+
"profile": {
|
|
40
|
+
"href": "https://api.mollie.com/v2/profiles/pfl_TestProfile",
|
|
41
|
+
"type": "application/hal+json"
|
|
42
|
+
},
|
|
43
|
+
"documentation": {
|
|
44
|
+
"href": "https://docs.mollie.com/reference/get-subscription",
|
|
45
|
+
"type": "text/html"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|