Skip to content

Instantly share code, notes, and snippets.

View cjavilla-stripe's full-sized avatar

CJ Avilla cjavilla-stripe

View GitHub Profile
""" stripe """
import stripe
import json
import configparser
from classes.models.models_user import Cart
from flask_login import current_user
from classes import app, db
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
const f = async () => {
try {
const res = await stripe.billingPortal.sessions.create({
customer: cus,
return_url: 'https://pay.cjavilla.com'
})
return {
statusCode: 200,
body: JSON.stringify(res),
};
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN}); // guessing this initializes stripe-node, and should be your platform's secret key, not the connected account's.
const pug = require('pug');
const render = pug.compileFile('./payment.pug')
/**
* An HTTP endpoint that acts as a webhook for Custom API or Webhook request event
* @returns {object.http} result Your return value
*/
module.exports = async (amount=null, frequency=null, email=null, firstname=null, lastname=null, street=null, zip=null, city=null, state=null, cellphone=null, occupation=null, employer=null) => {
const fec = {
$session = \Stripe\Checkout\Session::create([
'payment_method_types' => ['card'],
'line_items' => [[
'price_data' => [
'unit_amount' => 5000, # $50 per month
'currency' => 'usd',
'product_data' => ['name' => 'My Service Plan'],
'recurring' => [
'interval' => 'month',
],
@cjavilla-stripe
cjavilla-stripe / payment_intent.succeeded.with_customer.json
Created July 6, 2020 18:45
Fixture for firing payment_intent.succeeded with Customer.
{
"_meta": {
"template_version": 0
},
"fixtures": [
{
"name": "customer",
"path": "/v1/customers",
"method": "post",
"params": {
#!/usr/bin/ruby
require 'octokit'
require 'dotenv'
require 'restclient'
require 'json'
Dotenv.load('.env_shortcut')
GITHUB = "https://raw.githubusercontent.com/%s/master/.cli.json"
{
"id": "cs_test_xxx",
"object": "checkout.session",
"amount_subtotal": 2100,
"amount_total": 2499,
"cancel_url": "https://example.com/cancel",
"client_reference_id": null,
"currency": "usd",
"customer": "cus_yyy",
"livemode": false,
const acct = await stripe.accounts.update(
'acct_xxx', {
individual: {
dob: {
day: 15,
month: 8,
year: 2013,
},
},
},
$customer = \Stripe\Customer::create([
'email' => '[email protected]',
'payment_method' => 'pm_card_visa',
'invoice_settings' => [
'default_payment_method' => 'pm_card_visa',
],
]);
$connectCustomer = \Stripe\Customer::create([
'email' => '[email protected]',