Payment Method

Store a payment method through payment object

A payment object is an object generated by the PAYMILL API. The nonsensitive parts of the payment data of your clients are stored here. You can use them to create transactions or for documentation purposes.

Requirements: You have an account. (You can register here).
Use of the API: You have authenticated yourself.

1. Create client

In order to store the credit card data of a client, you must create his profile first.

On the homepage, go to Clients and click New client Create Client
      curl https://api.paymill.com/v2.1/clients \
        -u <YOUR_PRIVATE_KEY>: \
        -d "email=lovely-client@example.com" \
        -d "description=Lovely Client"
    

2. Create payment method

Requirements: You must have an account with MOTO (Mail Order/Telephone Order) activated.

Store the credit card data. Go to the details page of your client and click on Create payment method in the Means of payment section. Create Payment Method Select your desired payment type and enter the applicable information. Only specific credit card information / bank details are allowed in test mode. You can find the list here. Usage of any other data will result in error. Payment Method Form You can store several payment methods for a client. Payment Method Details
For the creation of a payment object via API you must enter a token. You can get this token through the PAYMILL Bridge.
Create new credit card payment with token and client
      curl https://api.paymill.com/v2.1/payments \
        -u <YOUR_PRIVATE_KEY>: \
        -d "token=<PAYMILL_TOKEN>" \
        -d "client=client_88a388d9dd48f86c3136"
    
Create new debit payment with token and client
      curl https://api.paymill.com/v2.1/payments \
        -u <YOUR_PRIVATE_KEY>: \
        -d "token=<PAYMILL_TOKEN>" \
        -d "client=client_88a388d9dd48f86c3136"
    

You can find examples for additional programming languages in our API documentation

Important: In the created payment object, the nonsensitive parts of the payment data of your clients are now stored. For all subsequent transactions and subscriptions, only the payment object is needed.

3. Validity of the payment method

LIVE mode
If no transaction is yet to be created with the payment object, the payment method is not yet valid. With the help of a preauthorization, you can validate your payment method without having to carry out a transaction. The preauthorization should occur within half a day of creating the payment object (if no transaction has occurred yet with this payment method).

A preauthorization of your payment object is only possible over the API.
During preauthorization over the API, it is required to input the live key, the payment object ID, the amount (this must correspond to the value during token creation), and the currency.
      curl https://api.paymill.com/v2.1/preauthorizations \
        -u <YOUR_PRIVATE_KEY>: \
        -d "payment=pay_d43cf0ee969d9847512b" \
        -d "amount=4200" \
        -d "currency=EUR"
    
You can find examples for additional programming languages in our API documentation

4. Create a payment

Create a new transaction with one of the payment types that are assigned to your client.

On the detail page of your client, you can now create a new transaction by clicking on Create transaction in the Transactions section. If you have created several payment methods, they are made available for you to select from under Payment type. Create Transaction
With your created payment methods, you can make a payment through the API in the following way:

Transaction with payment
      curl https://api.paymill.com/v2.1/transactions \
        -u <YOUR_PRIVATE_KEY>: \
        -d "amount=4200" \
        -d "currency=EUR" \
        -d "payment=pay_2f82a672574647cd911d" \
        -d "description=Test Transaction"
    
Transaction with payment and client
      curl https://api.paymill.com/v2.1/transactions \
        -u <YOUR_PRIVATE_KEY>: \
        -d "amount=4200" \
        -d "currency=EUR" \
        -d "client=client_c781b1d2f7f0f664b4d9" \
        -d "payment=pay_a818b847db6ce5ff636f" \
        -d "description=Test Transaction"
    
You can find examples for additional programming languages in our API documentation

You can find additional information in our FAQ's