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::CustomerThe 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
mistercashtobancontact - 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,refundedandcharged_backhave been removed - The status
cancelledhas 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_regionand/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_datetimehas been renamed tocanceled_atcreated_datetimehas been renamed tocreated_atexpired_datetimehas been renamed toexpired_atfailed_datetimehas been renamed tofailed_atpaid_datetimehas been renamed topaid_atrecurring_typehas 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_reasonhas been moved from the Payment resource to the credit card detail object, and no longer available for Bancontact payments.details.bitcoin_amountis now an amount object in the XBT currency
The following fields have been removed:
expiry_periodhas been removed from the Payment resource. You can useexpires_atwhich contains the same information.issuerhas been removed from the Payment resource. You can however, still pass it to the Create payment API.details.bitcoin_ratehas been removed from the Bitcoin detail objectdetails.card_countryhas been removed from the credit card detail object- The option to include the settlement using the
includequery string parameter has been removed
These new fields have been added:
settlement_amounthas 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 theamountproperty.- Note that for refunds and chargebacks, the
valuekey ofsettlement_amountwill 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 forbanktransferpayments. Your customer can check the status of their transfer at this URL.links['pay_online']has been added to the responses forbanktransferpayments. 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:
amountis now mandatory when creating a refund. You must specify bothamount.currencyandamount.value.- The
amountfield is now of theamounttype and contains avalueand 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_idfield. The payment resource can still easily be accessed using thepaymenthelper method.
These new fields have been added:
settlement_amounthas been added. See the explanation of the settlementAmount for the Payments API.
The following fields have been changed, renamed or moved:
- The
amountfield is now of theamounttype and contains avalueand acurrency chargeback_datetimehas been renamed tocreated_atreversed_datetimehas 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 thepaymenthelper 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_amounthas been added. See the explanation of the settlementAmount for the Payments API.
The following fields have been changed, renamed or moved:
amountincludingminimumandmaximumhave 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_typehas been renamed tosequence_type. Possible values areoneoff,firstorrecurring. - The parameter
amounthas been added. This should be an object containingvalueandcurrency. 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_datetimehas been renamed tocreated_atrecently_used_methodshas 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
canceledstatus is changed from British English to American English
The following fields have been changed, renamed or moved:
created_datetimehas been renamed tocreated_atcancelled_datetimehas been renamed tocanceled_at, and is now only returned when the subscription is canceled
The following fields have been changed, renamed or removed:
created_datetimehas been renamed tocreated_atupdated_datetimehas been removedphoneis now formatted in E.164 formatting- The API keys subresource has been removed
The following fields have been changed, renamed or moved:
created_datetimehas been renamed tocreated_atsettled_datetimehas been renamed tosettled_at- The fields
payment_ids,refund_idsandchargeback_idshas been removed - All amounts have been changed to the
amounttype. 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.vatandamount.grosshave been moved one level up asamount_net,amount_vatandamount_gross
The following fields have been changed, renamed or moved:
created_datetimehas 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_datehas been renamed toissued_atpaid_datehas been renamed topaid_atdue_datehas been renamed todue_atamount.net,amount.vatandamount.grosshave been moved one level up asamount_net,amount_vatandamountGross