node-stripe-payment-api is a RESTful API built with Node.js to perform transaction with Stripe integration
node-stripe-payment-api requires Node.js v6+ and npm installed to run.
First, you need to create a .env file in the root directory. The file contain the public and private keys of your Stripe API:
PUBLISHABLE_KEY=YOUR_PUBLIC_KEY_HERE
SECRET_KEY=YOUR_PRIVATE_KEY_HERE
Run the following command to download all the node dependencies:
npm install
To start the server:
npm start
The payment application will be running on port 3000
Admin required for all routes!
- GET
/balances
- List all balances
-
GET
/bankAccounts?userID=USER_ID&limit=INTEGER
- List all bank accountsUSER_ID (REQUIRE): The id of the user limit (optional): Number of bank_account objects from user to be returned. Limit can range between 1 and 100, and the default is 10.
-
POST
/bankAccounts/
- Create a bank accountrequest_body = { user_id (REQUIRED): The id of the user for this card account_number (REQUIRED): The account number for the bank account, in string form. Must be a checking account, country (REQUIRED): The country in which the bank account is located (Ex: US/JP), currency (REQUIRED): The currency the bank account is in. This must be a country/currency pairing that Stripe supports., account_holder_name (REQUIRED): The name of the person or business that owns the bank account, account_holder_type (REQUIRED): The type of entity that holds the account. This can be either ‘individual’ or ‘company’, routing_number (REQUIRED for US bank accounts, optional otherwise): The routing number, sort code, or other country-appropriate institution number for the bank account }
-
GET
/bankAoounts/:USER_ID/:BANK_ACCOUNT_ID
- Read a bank accountUSER_ID (REQUIRED): The ID of the user BANK_ACCOUNT_ID (REQUIRED): The id of the bank account
-
PUT
/bankAoounts/:USER_ID/:BANK_ACCOUNT_ID
- Update a bank accountUSER_ID (REQUIRED): The ID of the user BANK_ACCOUNT_ID (REQUIRED): The id of the card request_body = { account_holder_name (REQUIRED): The name of the person or business that owns the bank account, account_holder_type (REQUIRED): The type of entity that holds the account. This can be either ‘individual’ or ‘company’ }
-
DELETE
/bankAoounts/:USER_ID/:BANK_ACCOUNT_ID
- Delete a bank accountUSER_ID (REQUIRED): The ID of the user CARD_ID (REQUIRED): The id of the bank account
-
GET
/cards?userID=USER_ID&limit=INTEGER
- List all cardsUSER_ID (REQUIRE): The id of the user limit (optional): Number of card objects from user to be returned. Limit can range between 1 and 100, and the default is 10.
-
POST
/cards
- Create a cardrequest_body = { user_id (REQUIRED): The id of the user for this card card_number (REQUIRED): The number of the credit card, exp_month (REQUIRED): The card's expiration month in two-digit number, exp_year (REQUIRED): The card's expiration year in two- or four-digit number, cvc (REQUIRED): Card security code, name (optional): Cardholder's full name, address_line1 (optional): User’s address line 1, address_line2 (optional): User’s address line 2, address_city (optional): User’s city, address_state (optional): User’s state, address_zip (optional): User’s zip code, address_country (optional) User’s country }
-
GET
/cards/:USER_ID/:CARD_ID
- Read a cardUSER_ID (REQUIRED): The ID of the user CARD_ID (REQUIRED): The id of the card
-
PUT
/cards/:USER_ID/:CARD_ID
- Update a cardUSER_ID (REQUIRED): The ID of the user CARD_ID (REQUIRED): The id of the card request_body = { name (optional): Cardholder name, address_line1 (optional): User’s Address line 1, address_line2 (optional): User’s Address line 2, address_city (optional): City/District/Suburb/Town/Village, address_state (optional): State/County/Province/Region, address_zip (optional): User’s ZIP or postal code, address_country (optional): User’s billing address country, exp_month (optional): The card’s expiration month in two-digit number, exp_year (optional): The card’s expiration year in four-digit number }
-
DELETE
/cards/:USER_ID/:CARD_ID
- Delete a cardUSER_ID (REQUIRED): The ID of the user CARD_ID (REQUIRED): The id of the card
-
GET
/payments?limit=INTEGER
- List all paymentslimit (optional): Number of payment objects to be returned. Limit can range between 1 and 100, and the default is 10.
-
POST
/payments
- Create a paymentrequest_body = { amount (REQUIRED): A positive integer representing how much to charge, in the smallest currency unit (e.g., 100 cents to charge $1.00, or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 USD or equivalent in charge currency, currency (REQUIRED): Three-letter ISO currency code, in lowercase. Must be a supported currency, customer (REQUIRED): The user_id that will be charged in this request, source (REQUIRED): The card_id or the bank_account_id to be charged, description (optional): An arbitrary string which you can attach to this payment object, receipt_email (optional): The email address to which this charge’s receipt will be sent }
-
GET
/payments/:PAYMENT_ID
- Read a paymentPAYMENT_ID (REQUIRED): The id of the payment
-
PUT
/payments/:PAYMENT_ID
- Update a paymentrequest_body = { description (optional): An arbitrary string which you can attach to this payment object }
-
GET
/payouts?limit=INTEGER
- List all payoutslimit (optional): Number of payout objects to be returned. Limit can range between 1 and 100, and the default is 10.
-
POST
/payouts
- Create a payoutrequest_body = { amount (REQUIRED): A positive integer in cents representing how much to payout, currency (REQUIRED): Three-letter ISO currency code, in lowercase. Must be a supported currency, destination_id (optional): The bank_account_id or card_id to send the payout to. If no destination is supplied, the default external account for the specified currency will be used, description (optional): An arbitrary string attached to the object. Often useful for displaying to users }
-
GET
/payouts/:PAYOUT_ID
- Read a payoutPAYOUT_ID (REQUIRED)
-
DELETE
/payouts/:PAYOUT_ID
- Cancel a payoutPAYOUT_ID (REQUIRED)
-
GET
/refunds?limit=INTEGER
- List all refundslimit (optional): Number of refund objects to be returned. Limit can range between 1 and 100, and the default is 10.
-
POST
/refunds
- Create a refundrequest_body = { charge_id (REQUIRED): The id of the payment to refund }
-
GET
/refunds/:REFUND_ID
- Read a refundREFUND_ID (REQUIRED): The id of the refund
-
GET
/users?limit=INTEGER
- List all userslimit (optional): Number of user objects to be returned. Limit can range between 1 and 100, and the default is 10.
-
POST
/users
- Create a userrequest_body = { email (REQUIRED): ‘email@domain.com’, first_name (REQUIRED): ‘FIRST_NAME’, last_name (REQUIRED): ‘LAST_NAME’ }
-
GET
/users/:USER_ID
- Read a userUSER_ID (REQUIRED): The id of the user
-
PUT
/users/:USER_ID
- Update a userUSER_ID (REQUIRED): The id of the user request_body = { account_balance (optional): INTEGER, description (optional): ‘DESCRIPTION’ email (optional): ‘email@domain.com’, first_name (optional): ‘FIRST_NAME’, last_name (optional): ‘LAST_NAME’ }
-
DELETE
/users/:USER_ID
- Delete a userUSER_ID (REQUIRED): The id of the user
- Add authentication
- For more, see the issue tracker.
Hoyeung Lai (johnl4112@gmail.com).
MIT