Developer Guide

Payment Methods

Get a list of payment methods customer related

URL

GET https://api.billagain.com/v1/customers/{customerID}/paymentmethods

URL PARAMETERS (3 Fields)

Parameter Format Description
customerID req Numeric Unique customer identifier
page Numeric Current page number
page_size Numeric Amount of items on requested page

OUTPUT PARAMETERS (7 Fields)

Parameter Format Description
customerID Numeric Unique customer identifier
isPrimary Numeric Indicates if current payment method is primary
isValid Numeric Indicates if current payment method is valid
paymentMethodID Numeric Unique payment method ID identifier
PaymentMethodType Numeric Unique customer identifier
BankAccount Object Could be null depending on PaymentMethodType
AccountHolder Numeric Current payment method account holder name
LastFourDigits Numeric Last 4 digits on the card
CreditCard Object Could be null depending on PaymentMethodType
AccountHolder Numeric Current payment method account holder name
LastFourDigits Numeric Last 4 digits on the card

EXAMPLES

JSON Output

HTTP CODE: 200 OK
[
  {
    "customerID": 303,
    "paymentMethodID": 10111,
    "PaymentMethodType": "bank_account",
    "isPrimary": true,
    "isValid": true,
    "BankAccount": {
      "AccountHolder": "Rudi",
      "LastFourDigits": "3123"
    }
  },
  {
    "customerID": 303,
    "paymentMethodID": 10112,
    "PaymentMethodType": "credit_card",
    "isPrimary": false,
    "isValid": true,
    "CreditCard": {
      "NameOnCard": "Rudi Opperman",      
      "LastFourDigits": "1881"
    }
  },
  {
    "customerID": 303,
    "paymentMethodID": 10094,
    "PaymentMethodType": "bank_account",
    "isPrimary": false,
    "isValid": true,
    "BankAccount": {
      "AccountHolder": "Milly Jones",
      "LastFourDigits": "4234"
    }
  }
]

Get a list of payment methods

URL

GET https://api.billagain.com/v1/paymentmethods

URL PARAMETERS (2 Fields)

Parameter Format Description
page Numeric Current page number
page_size Numeric Amount of items on requested page

OUTPUT PARAMETERS (7 Fields)

Parameter Format Description
customerID Numeric Unique customer identifier
isPrimary Numeric Indicates if current payment method is primary
isValid Numeric Indicates if current payment method is valid
paymentMethodID Numeric Unique payment method ID identifier
PaymentMethodType Numeric Unique customer identifier
BankAccount Object Could be null depending on PaymentMethodType
AccountHolder Numeric Current payment method account holder name
LastFourDigits Numeric Last 4 digits on the card
EMandateToken Alpha Numeric Linked EMandate token
CreditCard Object Could be null depending on PaymentMethodType
AccountHolder Numeric Current payment method account holder name
LastFourDigits Numeric Last 4 digits on the card

EXAMPLES

JSON Output

HTTP CODE: 200 OK
[
  {
    "customerID": 269,
    "paymentMethodID": 10076,
    "PaymentMethodType": "credit_card",
    "isPrimary": true,
    "isValid": true,
    "CreditCard": {
      "NameOnCard": "John Doe",    
      "LastFourDigits": "2467"
    }
  },
  {
    "customerID": 289,
    "paymentMethodID": 10080,
    "PaymentMethodType": "bank_account",
    "isPrimary": true,
    "isValid": true,
    "BankAccount": {
      "AccountHolder": "Joe Soap",
      "LastFourDigits": "7899",
      "EMandateToken":  null
    }
  },
  {
    "customerID": 304,
    "paymentMethodID": 10097,
    "PaymentMethodType": "bank_account",
    "isPrimary": true,
    "isValid": true,
    "BankAccount": {
      "AccountHolder": "asd",
      "LastFourDigits": "5435"
    }
  }
]

Get specific payment method

URL

GET https://api.billagain.com/v1/paymentmethods/{paymentMethodID}

URL PARAMETERS (1 Field)

Parameter Format Description
paymentMethodID req Numeric Unique customer payment method identifier

OUTPUT PARAMETERS (7 Fields)

Parameter Format Description
customerID Numeric Unique customer identifier
isPrimary Numeric Indicates if current payment method is primary
isValid Numeric Indicates if current payment method is valid
paymentMethodID Numeric Unique payment method ID identifier
PaymentMethodType Numeric Unique customer identifier
BankAccount Object Could be null depending on PaymentMethodType
IBAN Numeric IBAN Number, populated only if Debit Method is Sepa
AccountNumber Numeric Account Number, will never be populated if Debit Method is Sepa
AccountHolder Numeric Current payment method account holder name
AccountType Numeric Type of bank account
Bank Numeric Current payment method bank name
DebitMethod Numeric Current payment method, type of debit
LastFourDigits Numeric Last 4 digits on the card
BranchCode Numeric Current payment method bank branch code
BIC Numeric BIC number, will only be populated if Debit Method is sepa
RoutingNumber Numeric RoutingNumber number, will only be populated if Debit Method is ach
EMandateToken Alpha Numeric Linked EMandate token
CreditCard Object Could be null depending on PaymentMethodType
CardType Numeric Credit card provider
ExpiryMonth Numeric Credit card expiry month
ExpiryYear Numeric Credit card expiry year
LastNameOnCard Numeric Credit card holder last name
NameOnCard Numeric Credit card holder name
LastFourDigits Numeric Last 4 digits on the card

EXAMPLES

JSON Output

HTTP CODE: 200 OK
{
  "customerID": 303,
  "paymentMethodID": 10111,
  "PaymentMethodType": "bank_account",
  "isPrimary": true,
  "isValid": true,
  "BankAccount": {
    "DebitMethod": "debit_order",
    "AccountType": "Savings",
    "AccountHolder": "Rudi",
    "LastFourDigits": "3123",
    "AccountNumber": "123123123",
    "Bank": "ST Bank",
    "BranchCode": "789587",	
		"EMandateToken":"5957c15d-e218-47cd-8168-0433bfca8550"	
  }
}

Add payment method - credit card

URL

POST https://api.billagain.com/v1/paymentmethods/creditcard

INPUT PARAMETERS (3 Fields)

Parameter Format Description
customerID req Numeric Unique customer identifier
isPrimary req Boolean Indicate if payment type should be primary
CreditCard req Object
CardType req Alpha Credit card provider:
  • Visa
  • Mastercard
  • American Express
  • Diners Club
  • Discover
  • JCB
  • Dankort
  • Maestro
  • Forbrugsforeningen
  • Unknown
Number req Numeric Credit card number
NameOnCard req Alpha Credit card holder name
LastNameOnCard req Alpha Credit card holder last name
ExpiryMonth req Numeric Credit card expiry month
ExpiryYear req Numeric Credit card expiry year

OUTPUT PARAMETERS (6 Fields)

Parameter Format Description
customerID Numeric Unique customer identifier
paymentMethodID Numeric Unique payment method ID identifier
PaymentMethodType Alpha Unique customer identifier
isPrimary Boolean Indicates if current payment method is primary
isValid Boolean Indicates if current payment method is valid
CreditCard Object
CardType Alpha Credit card provider
ExpiryMonth Numeric Credit card expiry month
ExpiryYear Numeric Credit card expiry year
LastNameOnCard Alpha Credit card holder last name
NameOnCard Alpha Credit card holder name
LastFourDigits Numeric Last 4 digits on the card

EXAMPLES

JSON Input

{
    "customerID":303,
    "isPrimary":true,
    "CreditCard":
    {
        "CardType":"Visa",
        "Number":4111111111111111,
        "NameOnCard":"Jona",
        "LastNameOnCard":"Hills",
        "ExpiryMonth":1,
        "ExpiryYear":2017
    }
}

JSON Output

HTTP CODE: 200 OK
{
  "customerID": 0,
  "paymentMethodID": 10113,
  "PaymentMethodType": "credit_card",
  "isPrimary": false,
  "isValid": true,
  "CreditCard": {
    "NameOnCard": "Rudi",
    "LastNameOnCard": "Opperman",
    "CardType": "Visa",
    "ExpiryMonth": 1,
    "ExpiryYear": 2017,
    "LastFourDigits": "1111"
  }
}

Get a list of subscriptions customer related

URL

Post https://api.billagain.com/v1/paymentmethods/bankaccount

INPUT PARAMETERS (3 Fields)

Parameter Format Description
customerID req Numeric Unique customer identifier
isPrimary req Boolean Indicate if payment type should be primary
BankAccount req Object
Method req Alpha Bank account method:
  • debit_order (Debit order)
  • ach (ACH)
  • sepa (SEPA Direct Debit)
AccountType req Alpha Account Type:
  • Savings
  • Cheque
AccountHolder req Alpha Bank account holder name
Bank req Alpha Bank account name
AccountNumber Numeric Bank account number. Not required for sepa
BranchCode Numeric Can only be set if debit method is neither sepa nor ach
RoutingNumber Numeric Routing Number required if debit method is ach
IBAN Numeric IBAN Number required if debit method is sepa
BIC Numeric BIC Number required if debit method is sepa
EMandateToken Alpha Numeric Linked EMandate token

OUTPUT PARAMETERS (6 Fields)

Parameter Format Description
customerID Numeric Unique customer identifier
paymentMethodID Numeric Unique payment method ID identifier
PaymentMethodType Alpha Unique customer identifier
isPrimary Boolean Indicates if current payment method is primary
isValid Boolean Indicates if current payment method is valid
BankAccount Object
AccountNumber Numeric Account Number, will never be populated if Debit Method is sepa
AccountType Alpha Type of bank account
AccountHolder Alpha Current payment method account holder name
DebitMethod Alpha Current payment method, type of debit
LastFourDigits Numeric Last 4 digits on the card
Bank Alpha Current payment method bank name
BranchCode Numeric Current payment method bank branch code
BIC Numeric BIC number, will only be populated if Debit Method is sepa
RoutingNumber Numeric RoutingNumber number, will only be populated if Debit Method is ach
EMandateToken Alpha Numeric Linked EMandate token

EXAMPLES

JSON Input

{
"customerID":303,
"isPrimary":true,
"BankAccount":
	{
		"Method":"debit_order",
		"AccountType":"Savings",
		"AccountHolder":"Rudi Opperman",
		"Bank":"ABC Bank",
		"AccountNumber":111111121234,
		"BranchCode":6099,	
		"EMandateToken":"5957c15d-e218-47cd-8168-0433bfca8550"	
	}
}

JSON Output

HTTP CODE: 200 OK
{
  "customerID": 0,
  "paymentMethodID": 10117,
  "PaymentMethodType": "bank_account",
  "isPrimary": true,
  "isValid": false,
  "BankAccount": {
    "DebitMethod": "Debit Order",
    "AccountType": "Savings",
    "AccountHolder": "Rudi Opperman",
    "LastFourDigits": "1234",
    "Bank": "ABC Bank",
    "BranchCode": "6099",	
		"EMandateToken":"5957c15d-e218-47cd-8168-0433bfca8550"	
  }
}

Set current payment method as primary

URL

PUT https://api.billagain.com/v1/paymentmethods/{paymentMethodID}/setprimary

URL PARAMETERS (1 Field)

Parameter Format Description
paymentMethodID req Numeric Unique customer payment method identifier

EXAMPLES

JSON Output

HTTP CODE: 204 No Content

Get a list of subscriptions customer related

URL

PUT https://api.billagain.com/v1/paymentmethods/bankaccount/{paymentMethodID}

URL PARAMETERS (1 Field)

Parameter Format Description
paymentMethodID req Numeric Unique customer payment method identifier

INPUT PARAMETERS (3 Fields)

Parameter Format Description
customerID req Numeric Unique customer identifier
isPrimary req Boolean Indicate if payment type should be primary
BankAccount Object
Method req Alpha Bank account method:
  • debit_order (Debit order)
  • ach (ACH)
  • sepa (SEPA Direct Debit)
AccountType req Alpha Account type:
  • Savings
  • Cheque
AccountHolder req Alpha Bank account holder name
Bank req Alpha Bank account name
AccountNumber Numeric Bank account number. Not required for sepa
BranchCode Numeric Can only be set if debit method is neither sepa nor ach
RoutingNumber Numeric Routing Number required if debit method is ach
IBAN Numeric IBAN Number required if debit method is sepa
BIC Numeric BIC Number required if debit method is sepa
EMandateToken Alpha Numeric Linked EMandate token

EXAMPLES

JSON Input

{
  "paymentMethodID": 10153,
  "PaymentMethodType": "bank_account",
  "isPrimary": true,
  "isValid": false,
  "BankAccount": {
    "Method": "sepa",
    "AccountType": "Savings",
    "AccountHolder": "Rudi Opperman",
    "LastFourDigits": "1234",
    "Bank": "ABC Bank",
    "IBAN": "123321",
    "BIC": "123321",
    "EMandateToken": "5957c15d-e218-47cd-8168-0433bfca8550"
  },
  "ExternalGateways": null
}


JSON Output

HTTP CODE: 204 No Content

Delete specific Payment Method, Primary method can never be deleted.

URL

DELETE https://api.billagain.com/v1/paymentmethods/{paymentMethodID}

URL PARAMETERS (1 Field)

Parameter Format Description
paymentMethodID req Numeric Unique customer payment method identifier

EXAMPLES

JSON Output

HTTP CODE: 204 No Content

Validate Bank Account details with a specific Gateway provider.

URL

Validate https://api.billagain.com/v1/ValidateBankAccount/{gatewayID}

URL PARAMETERS (1 Field)

Parameter Format Description
gatewayID req Numeric Unique Gateway ID

INPUT PARAMETERS (5 Fields)

Parameter Format Description
customerID Alpha Numeric Unique customer reference
PaymentMethodType Alpha Numeric Unique customer reference
isPrimary Alpha Numeric Unique customer reference
isValid Alpha Numeric Unique customer reference
BankAccount req Object
Method req Alpha Bank account method:
  • debit_order (Debit order)
  • ach (ACH)
  • sepa (SEPA Direct Debit)
AccountType req Alpha Account Type:
  • Savings
  • Cheque
AccountHolder req Alpha Bank account holder name
Bank req Alpha Bank account name
AccountNumber Numeric Bank account number. Not required for sepa
BranchCode Numeric Can only be set if debit method is neither sepa nor ach
RoutingNumber Numeric Routing Number required if debit method is ach
IBAN Numeric IBAN Number required if debit method is sepa
BIC Numeric BIC Number required if debit method is sepa
EMandateToken Alpha Numeric Linked EMandate token

EXAMPLES

JSON Output

HTTP CODE: 204 No Content