Giter Site home page Giter Site logo

apple-pay-relay-example's Introduction

Apple Pay Relay Demo

This server sample is expected to provide the minimal configuration needed to complete an Apple Pay Sandbox Transaction. It provides two endpoints that are required.

Endpoints

applepayrelay/session/start

Provides merchant validation for Apple Pay JS requests made from a web application.

If you're only deploying your application as a native app on iOS, then this endpoint is not required

applepayrelay/session/authorize

Provides a handler to authorize a transaction for a payment processor. In this demo, this method just returns some fake response data since we are handling sandbox data, but in a real application, you would outfit this endpoint to accept the token data and authorize the transaction.

Certificates and Keys

You should place your Apple Pay Merchant certificate and private key in the assets folder and reference these files before building the final output.

Generating your own keys

When generating your certificate signing request (CSR), going through Key Chain doesn't provide the private key that you need for signing your merchant validation API request (that I'm aware of). The best way that I found was to generate the CSR and private key using the command line.

$ openssl req -new -newkey rsa:2048 -nodes -keyout applepay.key -out applepay.csr -subj '/O=Company Name/C=US'

Company Name and US and the end of that command should be replaced with your company name and country code.

This command should generate both the CSR that you can then exchange in the developer portal for your merchant certificate. The certificate, together with the private key can then be used to sign your merchant validation request in this server.

Building This Demo

The demo provides a simple Dockerfile that can be used to package the application for easy distribution on a server. Follow the steps below to build your own container.

$ docker build --tag my-container-name:tag .
$ docker run -dit -p 3000:3000 --name=apple-pay-relay --restart=unless-stopped my-container-name:tag

This runs your container and exposes the API on port 3000. You can then use a reverse proxy service such as NGINX to route requests to this port.

apple-pay-relay-example's People

Contributors

dallastjames avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  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.