Skip to content

Instantly share code, notes, and snippets.

//LineItem:
var lineItem = {
type: "final",
label: "Subtotal",
amount: "1234.56"
};
//PaymentContact:
var contact = {
emailAddress: "test@email.com",
//Amount:
var amount = {
currency: "USD",
value: "4.50"
};
//LineItem < Item:
var lineItem = {
label: “Subtotal”,
amount: amount
// WePay PHP SDK - http://git.io/mY7iQQ
require 'wepay.php';
// oauth2 parameters
<span class="variable">$code</span> = $_GET['code']; // the code parameter from step 2
<span class="variable">$redirect_uri</span> = "http://www.example.com/oauth2_redirect_uri"; // this is the redirect_uri you used in step 1
// application settings
<span class="variable">$client_id</span> = 123456789;
<span class="variable">$client_secret</span> = "1a3b5c7d9";
curl https://stage.wepayapi.com/v2/oauth2/token \
-d "client_id=123456789" \
-d "client_secret=1a3b5c7d9" \
-d "code=52sdga231sddd213jj9a" \
-d "redirect_uri=http://www.example.com/oauth2_redirect_uri"
# WePay Ruby SDK - http://git.io/a_c2uQ
require 'wepay'
# application settings
client_id = '123456789'
client_secret = '1a3b5c7d9'
use_stage = true
wepay = WePay::Client.new(client_id, client_secret, use_stage)
<?php
// WePay PHP SDK - http://git.io/mY7iQQ
require 'wepay.php';
// application settings
$client_id = 123456789;
$client_secret = "1a3b5c7d9";
$access_token = "STAGE_8a19aff55b85a436dad5cd1386db1999437facb5914b494f4da5f206a56a5d20";
// change to useProduction for live environments
curl https://stage.wepayapi.com/v2/preapproval/create \
-H "Authorization: Bearer STAGE_8a19aff55b85a436dad5cd1386db1999437facb5914b494f4da5f206a56a5d20" \
-d "account_id=123456789" \
-d "period=once" \
-d "amount=19.99" \
-d "mode=regular" \
-d "short_description=A subscription to our magazine." \
-d "redirect_uri=http://example.com/success/"
<?php
// WePay PHP SDK - http://git.io/mY7iQQ
require 'wepay.php';
// application settings
$account_id = 123456789;
$client_id = 9543125;
$client_secret = "1a3b5c7d9";
$access_token = "STAGE_8a19aff55b85a436dad5cd1386db1999437facb5914b494f4da5f206a56a5d20";
curl https://stage.wepayapi.com/v2/preapproval/create \
-H "Authorization: Bearer STAGE_8a19aff55b85a436dad5cd1386db1999437facb5914b494f4da5f206a56a5d20" \
-d "account_id=123456789" \
-d "period=once" \
-d "amount=19.99" \
-d "mode=regular" \
-d "short_description=A subscription to our magazine." \
-d "redirect_uri=http://example.com/success/"
# WePay Ruby SDK - http://git.io/a_c2uQ
require 'wepay'
# application settings
account_id = 123456789
client_id = 9543125
client_secret = '1a3b5c7d9'
access_token = 'STAGE_8a19aff55b85a436dad5cd1386db1999437facb5914b494f4da5f206a56a5d20'
# set _use_stage to false for live environments