GithubHelp home page GithubHelp logo

isabella232 / outlook-payments-nodejs-sample Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 40 KB

A sample Node.js implementation of a payment webhook for Payments in Outlook.

License: MIT License

JavaScript 100.00%

outlook-payments-nodejs-sample's Introduction

page_type products languages description urlFragment extensions
sample
office
office-365
office-outlook
javascript
This is an example implementation of the payment request and payment complete webhooks for a Payments in Outlook service.
outlook-payments-sample
contentType createdDate
samples
4/24/2018 7:43:42 AM

Sample Node.js Payments in Outlook webhook

This is an example implementation of the payment request and payment complete webhooks for a Payments in Outlook service.

Prerequisites

Prior to running this sample, you must register in the Payments in Outlook dashboard and you must have a Stripe connect platform account.

You must also have Node.js and NPM installed.

Running the sample

  1. Install dependencies with the following command:

    npm install
  2. Run the sample with the following command:

    npm start

Using ngrok to run locally

When you run the sample locally, it is accessible via http://localhost:3333. The Payment service must be able to contact your webhook from the internet, so running on localhost won't work. However, by using ngrok, we can create a publicly accessible address that is temporarily able to contact localhost.

Open a command prompt or shell and run the following command:

ngrok http 3333 -host-header=localhost:3333

The output should look similar to this:

ngrok by @inconshreveable                                     (Ctrl+C to quit)

Session Status                online
Account                       Jason Johnston (Plan: Free)
Version                       2.2.8
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
Forwarding                    http://68cd84ed.ngrok.io -> localhost:3333
Forwarding                    https://68cd84ed.ngrok.io -> localhost:3333

Copy the HTTPS URL from the second Forwarding entry. In the above output, the URL to copy is https://68cd84ed.ngrok.io. Using that URL as the base, let's construct two URLs: one to the payment request webhook (ngrok URL + /api/update), and one to the payment complete webhook (ngrok URL + /api/complete). For example, using the URL from the example output above:

https://68cd84ed.ngrok.io/api/update
https://68cd84ed.ngrok.io/api/complete

Note:: Leave ngrok running so those URLs remain active.

Update your webhook URLs in the partner dashboard with these URLs for testing.

A screenshot of the webhook URLs in the Payments in Outlook dashboard

Generating a test payment request message

See Get started with Payments in Outlook for steps to send a test message to yourself.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

outlook-payments-nodejs-sample's People

Contributors

jasonjoh avatar microsoftopensource avatar msftgits avatar o365devx avatar supernova-eng avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.