PaymentMethod

In order to charge a customer you must first create a payment method. This can be done by using the/create endpoint. Learn more about managing payment methods here.

Introduction

The PaymentMethod model represents a payment method that can be used to charge a customer.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the conversation.

  • Name
    customerId
    Type
    string
    Description

    Unique identifier for the customer.

  • Name
    isDefault
    Type
    string
    Description

    Whether or not this is the default payment method for the customer.

  • Name
    lastFour
    Type
    string
    Description

    The last four digits of the card number.

  • Name
    cardNetwork
    Type
    string
    Description

    The brand of the card.

  • Name
    expirationMonth
    Type
    string
    Description

    The expiration month of the card.

  • Name
    expirationYear
    Type
    string
    Description

    The expiration year of the card.

  • Name
    createdAt
    Type
    string
    Description

    The date and time the payment method was created.

  • Name
    updatedAt
    Type
    string
    Description

    The date and time the payment method was last updated.


GET/payment-method/get/:customerId

Get PaymentMethod

This endpoint allows you to get all payment methods for a customer. A customer id is required to get payment methods.

Optional attributes

  • Name
    limit
    Type
    integer
    Description

    Limit the number of conversations returned.

  • Name
    muted
    Type
    boolean
    Description

    Only show conversations that are muted when set to true.

  • Name
    archived
    Type
    boolean
    Description

    Only show conversations that are archived when set to true.

  • Name
    pinned
    Type
    boolean
    Description

    Only show conversations that are pinned when set to true.

  • Name
    group_id
    Type
    string
    Description

    Only show conversations for the specified group.

Request

GET
/payment-method/get/:customerId
  curl --location --request GET 'https://api.bluehillpayments.io/payment-method/get/A193991116B74CC69ED2413664201AAC'

Response

[
  {
      "achToken": null,
      "cardNetwork": "Visa",
      "customerId": "A193991116B74CC69ED2413664201AAC",
      "expirationMonth": "12",
      "expirationYear": "2022",
      "id": "1EAE8BA8658A42D1AAF28E0334CD52E9",
      "isDefault": true,
      "lastFour": "1111",
      "paymentMethodType": "credit_card"
  },
  {
      "achToken": null,
      "cardNetwork": "MasterCard",
      "customerId": "A193991116B74CC69ED2413664201AAC",
      "expirationMonth": "12",
      "expirationYear": "22",
      "id": "461F51B436EC4446A1FD5FF5F086E706",
      "isDefault": true,
      "lastFour": "3598",
      "paymentMethodType": "credit_card"
  },
  ...

]


POST/payment-method/create

Create a PaymentMethod Card

This endpoint allows you to create a payment method for a customer. A customer id is required to create a payment method.

Sandbox Cards:

NameValue
cardNumber4111 1111 1111 1111
expirationMonth12
expirationYear2027
cvv123

Required attributes

  • Name
    customerId
    Type
    string
    Description

    Unique identifier for the customer.

  • Name
    cardNumber
    Type
    string
    Description

    The card number

  • Name
    expirationMonth
    Type
    string
    Description

    The expiration month of the card.

  • Name
    expirationYear
    Type
    string
    Description

    The expiration year of the card.

  • Name
    cvv
    Type
    string
    Description

    The cvv of the card.


    IMPORTANT: This will not be stored past the first authorization
  • Name
    isLive
    Type
    boolean
    Description

    Whether or not this is a live card.


    IMPORTANT: This will determine if a charge is sandbox or production

Request

POST
/payment-method/create
curl --location --request POST 'https://api.bluehillpayments.io/payment-method/create' \
--header 'Content-Type: application/json' \
--data-raw '{
    "customerId" : "EC8CD046740E43298BB1636DB0923A91", 
    "cardNumber" : "4111 1111 1111 1111", 
    "expirationMonth": "08",
    "expirationYear": "2026", 
    "cvv": "264",
    "type": "card",
    "isLive": false
}'

Response

{
    "achToken": null,
    "cardNetwork": "Visa",
    "customerId": "EC8CD046740E43298BB1636DB0923A91",
    "expirationMonth": "08",
    "expirationYear": "2026",
    "id": "7E1F9B4988BE4A5A91FE9CB1B3F0056D",
    "isDefault": true,
    "lastFour": "1111",
    "paymentMethodType": "credit_card"
}

POST/payment-method/create

Create a PaymentMethod ACH

This endpoint allows you to create an ACH payment method for a customer

Sandbox Cards:

NameValue
routingNumber121000248
accountNumber123123123

Required attributes

  • Name
    customerId
    Type
    string
    Description

    Unique identifier for the customer.

  • Name
    routingNumber
    Type
    string
    Description

    The routing number of the bank

  • Name
    accountNumber
    Type
    string
    Description

    The account number of the bank

  • Name
    type
    Type
    string
    Description

    Value can be ach or card

  • Name
    isLive
    Type
    boolean
    Description

    Whether or not this is a live card.

Request

POST
/payment-method/create
curl --location --request POST 'https://api.bluehillpayments.io/payment-method/create' \
--header 'Content-Type: application/json' \
--data-raw '{
    "customerId" : "EC8CD046740E43298BB1636DB0923A91", 
    "routingNumber" : "121000248", 
    "accountNumber": "123123123",
    "type": "ach",
    "isLive": false
}
'

Response

{
    "achToken": null,
    "cardNetwork": "Visa",
    "customerId": "EC8CD046740E43298BB1636DB0923A91",
    "expirationMonth": "08",
    "expirationYear": "2026",
    "id": "7E1F9B4988BE4A5A91FE9CB1B3F0056D",
    "isDefault": true,
    "lastFour": "1111",
    "paymentMethodType": "credit_card"
}

GET/payment-method/delete

Delete PaymentMethod

This endpoint allows you to delete a payment method for a customer

Request

DELETE
/payment-method/delete
  curl --location --request DELETE 'https://api.bluehillpayments.io/payment-method/delete/ABDB91005492421BA19A9174A1EC5E0B' \
  --header 'Content-Type: application/json' \
  --data-raw '{
      "customerId" : "014E1518BD1A4B72A6EE5CE63B94D3E8", 
      "tokenId": "ABDB91005492421BA19A9174A1EC5E0B"
  }'

Response

{
    "achToken": null,
    "cardNetwork": "Visa",
    "customerId": "EC8CD046740E43298BB1636DB0923A91",
    "expirationMonth": "08",
    "expirationYear": "2026",
    "id": "7E1F9B4988BE4A5A91FE9CB1B3F0056D",
    "isDefault": true,
    "lastFour": "1111",
    "paymentMethodType": "credit_card"
}