Business - Payment Methods

The user can specify several payment methods, and store pre-authorization binary blobs on the server.

The base url for the APIs in this page is at:

/api/business-mobile/

A JSON file with OpenAPI data about all business-related mobile APIs can be downloaded here.

List actual methods

GET /v1/payment-methods/list

Lists all configured Payment Methods for this user

Status Codes

If there is an error the response will be negative without any further indications.

If positive, Data will be:

[
  {
    ID: 7,                                           // Int
    CreatedDate: "2001-01-01T01:01:01Z",             // DateTime
    Name: "Personal PayPal Account",                 // String
    Type: 3,                                         // Int (enum)
    LastValidTransaction: "2001-01-01T01:01:01Z",    // DateTime (nullable)
    LastErrorDescription: "",                        // String
    IsPreferred: true,                               // Boolean
    CardHolderName: "Credit card holder",            // String (nullable)
    CardNumber: "Credit card number",                // String (nullable)
    CardBrand: "Credit card circuit",                // String (nullable)
    CardExpiryYear: "Credit card expiry year",       // String (nullable)
    CardExpiryMonth: "Credit card expiry month"      // String (nullable)
  },
  ...
]

Type can be one of the PaymentMethodTypes enumeration.

Add new method

POST /v1/payment-methods/new

Add a new payment method for the current user

Status Codes

With a request body like this:

{
  Name: "Personal PayPal Account",                   // String
  Type: 3                                            // Int
}

Where Type can be one of the PaymentMethodTypes enumeration.

Furthermore, the API accepts the parameters needed for the payment gateway to retrieve the recurrent payment authorization data and the credit card data. The request body for this varies depending on the payment method’s type, that can be one of the values defined in the PaymentMethodTypes enumeration.

For WorldPay the body is the following:

{
  Session: "session token",              // String
  CardHolderName "Credit card holder"    // String
}

Possible errors are:

err_InvalidElement

One of the required request body properties is missing or not set

Add new method with authorization data

Creates a new payment method, adding authorization and credit card data

POST /v1/payment-methods/add-authorization-data

Creates a new method with the default gateway type and adds the authorization data

Status Codes

The API creates a new payment method for the platform’s default gateway, as defined in the environment variable DEFAULT_PAYMENT_METHOD, whose value can be one of the PaymentMethodTypes enumeration.

The request body format varies depending on the variable’s value. For WorldPay the body is the following:

{
  Session: "session token",              // String
  CardHolderName "Credit card holder"    // String
}

The API will respond with a generic error if the user already has a payment method defined, or if some error occurs in the process, or with the following error code:

err_InvalidElement

One of the required request body properties is missing or not set

Add authorization data to a method

Adds card authorization data to an existing payment method

POST /v1/payment-methods/{paymentMethodId}/add-authorization-data

Adds authorization data to an existing payment method

Parameters
  • paymentMethodId (integer) –

Status Codes

The request body varies depending on the payment method’s type, that can be one of the values defined in the PaymentMethodTypes enumeration.

For WorldPay the body is the following:

{
  Session: "session token",              // String
  CardHolderName "Credit card holder"    // String
}

Possible errors are:

err_InvalidElement

One of the required request body properties is missing or not set

Update data

POST /v1/payment-methods/edit/{id}

Update a payment method for the current user

Parameters
  • id (integer) – The payment method to update

Status Codes

With a request body like this:

{
  Name: "Personal PayPal Account",                   // String
  Type: 3                                            // Int
}

Where Type can be one of the PaymentMethodTypes enumeration. The result can be a plain positive response or a negative response with no additional data.

Delete one

DELETE /v1/payment-methods/{id}

Delete a payment method

Parameters
  • id (integer) – The payment method to delete

Status Codes

The result can be a plain positive response or a negative response with no additional data.