Skip to content

gettilled/simple-payment-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ This repository contains a standalone example to be used as a reference to help our partners integrate with Tilled. It is not intended to be implemented in a production environment nor is it intended to be installed as a dependency in any way.

Dependencies

Get started

  • Clone the project
  • Install dependencies:
    $ npm install
    

Retrieve your configuration values

Before you can run this example, you will need to create a sandbox account and add your configuration values.

  • Retrieve your Secret and Publishable API keys
    • If you don't have a Secret and Publishable API key, you can create them here.
  • Retrieve the Merchant Account ID. To do this, you can go to the Merchants page and click on the Merchant you want to use. The Merchant Account ID will be located on the Company Overview box under the Account ID field.
    • By default, you should already have a Merchant account named Shovel Shop (demo).
      • Optionally, you can create a new Merchant by following the instructions here
        • Note: Prefix the name of the account with an asterisk (ex. *The Surf Shop) to bypass needing to submit an onboarding form.

Add your configuration values

  • Create a .env file in this project's root directory (simple-payment-example/.env) with your Secret API Key:

    TILLED_SECRET_KEY=sk_...
  • Add your Merchant Account ID and Publishable API Key to index.html (Lines 238-239)

    const accountId = "acct_...";
    const publishableKey = "pk_...";

Run the server

  • Enter the following command from this project's root:

    $ node app.js

Process your first payment

Simple Payment Example

  • Open your web browser and go to http://localhost:3000

    • Enter 4037111111000000 as the card number, use a valid expiration date for the card, and enter 123 as the CVV code.
    • Fill out the billing details section.
    • Click the Pay to complete the payment.
      • Optionally, you can use your browser's developer console to review the logs related to the creation of the payment intent.
  • To view the payment in the Tilled Console, go here.

  • You can utilize the Testing page in our Tilled Docs for Test Card Numbers and ACH routing numbers, Simulating Errors, and more.

    • For test cards to use in the Sandbox environment, see the Basic Test Card Numbers section.
    • For ACH payments, the Account Number can be any 4 or 17-digit number, but the Routing Number must a valid test routing number. See the ACH Debit Testing section.

Manually create payment methods

Create Payment Method Example

  • In the browser, toggle the Save payment method? switch, make sure to fill out the billing details, and then click the Save button.
    • This will create a payment method without processing a payment.
  • View the paymentMethod ID in the alert or the console.

What's Next?

You can try out attaching payment methods to customers, adding metadata, including platform fees on payment intents and much, much more via the Tilled API.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published