Version 4.x of the Ruby client uses the v2 Mollie API. Please refer to Migrating from v1 to v2 for a general overview of the changes introduced by the new Mollie API.
Code examples can be found in the /examples folder.
Several helper methods were added to retrieve nested resources. Nested resources now return a collection or the object itself:
payment = Mollie::Payment.get('tr_7UhSN1zuXS')
refunds = payment.refunds # => Mollie::List
customer = payment.customer # => Mollie::Customer
The Ruby client v4 adds support for multi-currency. All amounts are parsed as a
Mollie::Amount
object.
payment = Mollie::Payment.create(
amount: { value: '42.10', currency: 'EUR' },
description: 'My first payment'
)
payment = Mollie::Payment.get('tr_7UhSN1zuXS')
payment.amount # => Mollie::Amount
payment.amount.value # => 42.10 # BigDecimal
payment.amount.currency # => 'EUR'
Note: If you specify an amount, you must specify the correct number of decimals. We strongly recommend sending value as a string. Note that even though most currencies use two decimals, some use three or none, like JPY. All amounts returned in the v2 API will use this format.
A RequestError
is raised for all API error responses. The RequestError
object
contains the following details:
status
: HTTP status code of the responsetitle
: Title of the errordetail
: Extra information about the errorfield
: Field of your request that is likely causing the error. Only available in case of 422 Unprocessable Entity errors.links
: Links to relevant API documentation
- The identifier for the payment method Bancontact has been renamed from
mistercash
tobancontact
- Some resources support embedding of related sub-resources. For instance, when retrieving a payment
any refunds can be embedded by using the
embed: 'refunds'
option. See the Get payment documentation for more information.
Only full locales with both the language and the country code are supported,
e.g. nl_NL
. Locales are always returned as full locales.
Formatting of fields such as created_at
has been updated to be strictly
compliant to ISO-8601 formatting. Example value: 2018-03-05T12:30:10+00:00
.
The following changes have been made in regards to the status of payments:
- The statuses
paidout
,refunded
andcharged_back
have been removed - The status
cancelled
has been renamed tocanceled
(US English spelling) - The individual billing and shipping address parameters that can be used when
creating a credit card or PayPal payment have been replaced by address objects.
Instead of passing
billing_address
,billing_postal
,billing_city
,billing_region
and/orbilling_country
(or the equivalent fields starting withshipping
), one should now pass abilling_address
(and/orshipping_address
) object, as follows:
{
amount: { value: '100.00', currency: 'USD' },
description: 'My first payment',
billing_address: {
street_and_number: 'Dorpstraat 1',
postal_code: '1122 AA',
city: 'Amsterdam',
region: 'Noord-Holland',
country: 'NL'
}
}
The following fields have been changed, renamed or moved:
cancelled_datetime
has been renamed tocanceled_at
created_datetime
has been renamed tocreated_at
expired_datetime
has been renamed toexpired_at
failed_datetime
has been renamed tofailed_at
paid_datetime
has been renamed topaid_at
recurring_type
has been renamed tosequence_type
. This field is now always present. A one-off payment (not the start of a recurring sequence and not a recurring payment) will have the valueoneoff
.failure_reason
has been moved from the Payment resource to the credit card detail object, and no longer available for Bancontact payments.details.bitcoin_amount
is now an amount object in the XBT currency
The following fields have been removed:
expiry_period
has been removed from the Payment resource. You can useexpires_at
which contains the same information.issuer
has been removed from the Payment resource. You can however, still pass it to the Create payment API.details.bitcoin_rate
has been removed from the Bitcoin detail objectdetails.card_country
has been removed from the credit card detail object- The option to include the settlement using the
include
query string parameter has been removed
These new fields have been added:
settlement_amount
has been added to the responses of the Payments API, the Refunds API and the Chargebacks API. This optional field will contain the amount that will be settled to your account, converted to the currency your account is settled in. It follows the same syntax as theamount
property.- Note that for refunds and chargebacks, the
value
key ofsettlement_amount
will be negative. - Any amounts not settled by Mollie will not be reflected in this amount, e.g. PayPal or gift cards.
- Note that for refunds and chargebacks, the
links['status']
has been added to the responses forbanktransfer
payments. Your customer can check the status of their transfer at this URL.links['pay_online']
has been added to the responses forbanktransfer
payments. At this URL your customer can finish the payment using an alternative payment method also activated on your website profile.
The following fields have been changed, renamed or moved:
amount
is now mandatory when creating a refund. You must specify bothamount.currency
andamount.value
.- The
amount
field is now of theamount
type and contains avalue
and acurrency
payment
, which contained the payment resource related to the refund, is no longer returned. Instead, the payment ID is returned by default, in thepayment_id
field. The payment resource can still easily be accessed using thepayment
helper method.
These new fields have been added:
settlement_amount
has been added. See the explanation of the settlementAmount for the Payments API.
The following fields have been changed, renamed or moved:
- The
amount
field is now of theamount
type and contains avalue
and acurrency
chargeback_datetime
has been renamed tocreated_at
reversed_datetime
has been renamed toreversed_at
. This field is now only returned if the chargeback is reversed.payment
, which contained the payment ID related to the chargeback, has been renamed topayment_id
. The payment resource can easily be accessed using thepayment
helper method.- Pagination has been removed, so all fields related to pagination are not available anymore. The list method will now return all chargebacks.
These new fields have been added:
settlement_amount
has been added. See the explanation of the settlementAmount for the Payments API.
The following fields have been changed, renamed or moved:
amount
includingminimum
andmaximum
have been removed- Pagination has been removed, so all fields related to pagination are not available anymore. The list method will now return all payment methods.
The following parameters have been changed or added:
- The parameter
recurring_type
has been renamed tosequence_type
. Possible values areoneoff
,first
orrecurring
. - The parameter
amount
has been added. This should be an object containingvalue
andcurrency
. Only payment methods that support the amount/currency will be returned.
The issuers API has been removed. Instead, you can get the issuers via the Get Method API using the issuers
include.
The following fields have been changed, renamed or moved:
created_datetime
has been renamed tocreated_at
recently_used_methods
has been removed
The following changes have been made in regards to the status of subscriptions:
- Subscriptions that are canceled can be retrieved from the API
- The
canceled
status is changed from British English to American English
The following fields have been changed, renamed or moved:
created_datetime
has been renamed tocreated_at
cancelled_datetime
has been renamed tocanceled_at
, and is now only returned when the subscription is canceled
The following fields have been changed, renamed or removed:
created_datetime
has been renamed tocreated_at
updated_datetime
has been removedphone
is now formatted in E.164 formatting- The API keys subresource has been removed
The following fields have been changed, renamed or moved:
created_datetime
has been renamed tocreated_at
settled_datetime
has been renamed tosettled_at
- The fields
payment_ids
,refund_ids
andchargeback_ids
has been removed - All amounts have been changed to the
amount
type. Note that thecosts.amount
* fields can have more decimals than you would expect. The same goes forrate.fixed
, which can contain fractional cents. amount.net
,amount.vat
andamount.gross
have been moved one level up asamount_net
,amount_vat
andamount_gross
The following fields have been changed, renamed or moved:
created_datetime
has been renamed tocreated_at
The fields country
, registration_date
and registration_type
have been removed.
The field address
is now an OpenStruct
with address details. See
Address object.
The field warning
has been removed.
issued_date
has been renamed toissued_at
paid_date
has been renamed topaid_at
due_date
has been renamed todue_at
amount.net
,amount.vat
andamount.gross
have been moved one level up asamount_net
,amount_vat
andamountGross