Once you've securely collected and tokenized your customer's credit card using Stripe.js, you can charge the card from a PubNub function. You can do things like sell products or services, restrict access to a webpage, sell a digital download, or accept donations.
You'll need a Stripe account and API keys. You don't need to activate your account unless you plan to go beyond testing. Add your test secret key to the PubNub Vault under the key sk_test
. Stripe charges 2.9% + 30¢ per successful card charge.
First, tokenize using Stripe.js. When you use Stripe.js on your website, the credit card data entered into your payment form is never sent to PubNub servers. This makes you automatically PCI compliant because you don't handle or store any sensitive credit card data on PubNub servers.
It is against PubNub Terms and Conditions to send credit card information including credit card numbers, CSV numbers (three-digit codes for Visa and MasterCard, four-digit code for American Express) and magnetic stripe information through the PubNub network.
Publish a HTTP POST containing the token provided by Stripe.JS.
?token=tok_visa
Need help? Contact PubNub Support.
Copyright (c) 2018 PubNub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.