Client - max-power/paymill-ruby GitHub Wiki

The clients object is used to edit, delete, update clients as well as to permit refunds, subscriptions, insert credit card details for a client, edit client details and of course make transactions. Clients can be created individually by you or they will be automatically generated with the transaction if there is no client ID transmitted.

Create new Client

This function creates a client object.

Paymill::Client.create(email: '[email protected]', description: 'Lovely Client')

Client Details

To get the details of an existing client you’ll need to supply the client ID. The client ID is returned by creating a client.

client = Paymill::Client.find('client_88a388d9dd48f86c3136')
client.transactions  # [<Paymill::Transaction>, ...]
client.subscriptions # [<Paymill::Subscription>, ...]
client.payments      # [<Paymill::CreditCard>, <Paymill::DirectDebit>, ...]

Update Client

This function updates the data of a client. To change only a specific attribute you can set this attribute in the update request. All other attributes that shouldn’t be edited aren’t inserted. You can only edit the description, email and credit card. The subscription can’t be changed by updating the client data. This has to be done in the subscription call.

Paymill::Client.update('client_88a388d9dd48f86c3136', email: '[email protected]', description: 'Lovely Client')

Remove Client

This function deletes a client, but your transactions aren’t deleted.

Paymill::Client.delete('client_88a388d9dd48f86c3136')

or if you have an initialize Client

client = Paymill::Client.find('client_88a388d9dd48f86c3136')
client.delete # this is also aliased to destroy

List Clients

This function returns a JSON object with a list of clients. In which order this list is returned depends on the optional parameter order. The following parameters can be used:

Paymill::Client.all
⚠️ **GitHub.com Fallback** ⚠️