Method: Supreme::API#fetch

Defined in:
lib/supreme/api.rb

#fetch(options) ⇒ Object

Starts a new payment by sending payment information. It also configures how the iDEAL provider handles payment status information. It returns a Supreme::Transaction response object.

Returns a Supreme::Error when the call fails.

Options

Note that the :description option has a character limit of 29 characters. Anything after the 29 characters will be silently removed by the API. Note that this description might be handled by ancient bank systems and anything but ASCII characters might be mangled or worse.

Required

  • :bank_id – The bank selected by the customer from the banklist.

  • :amount – The amount you want to charge in cents (EURO) (ie. €12,99 is 1299)

  • :description – Describe what the payment is for (max 29 characters) (ie. ‘Fluffy Bunny (sku 1234)’ )

  • :report_url – You will receive a GET to this URL with the transaction_id appended in the query (ie. example.com/payments?transaction_id=23ad33)

  • :return_url – The customer is redirected to this URL after the payment is complete. The transaction_id is appended as explained for :report_url

Optional

  • :partner_id – Your Mollie Partner ID, you can find it under ‘Accountgegevens’ in the settings for your account on mollie.nl. Note that the Partner ID is only optional if you’ve set it either on the API instance or using Supreme.partner_id.

  • :profile_key – When your account receives payment from different websites or companies you can set up company profiles. See the Mollie documentation for more information: www.mollie.nl/support/documentatie/betaaldiensten/ideal/.

Example

transaction = Supreme.api.fetch({
  :bank_id => '0031',
  :amount => 1299,
  :description => '20 credits for your account',
  :report_url => 'http://example.com/payments/ad74hj23',
  :return_url => 'http://example.com/payments/ad74hj23/thanks'
})
@purchase.update_attributes!(:transaction_id => transaction.transaction_id)

See the Supreme::Transaction class for more information.



84
85
86
87
88
89
90
91
92
93
94
# File 'lib/supreme/api.rb', line 84

def fetch(options)
  options = options.dup
  options[:partner_id] ||= partner_id
  response = get('fetch', Supreme.translate_hash_keys({
    :partner_id => :partnerid,
    :return_url => :returnurl,
    :report_url => :reporturl
  }, options))
  log('Fetch response', response.body)
  Supreme::Response.for(response.body, Supreme::Transaction)
end