Skip to content

Instantly share code, notes, and snippets.

<script type="text/javascript" src="https://static.wepay.com/min/js/tokenization.v2.js">
</script>
<script type="text/javascript">
WePay.set_endpoint("stage"); // change to "production" when live
function chargeCard(){
var response = WePay.credit_card.create( {
"client_id":118711,
"user_name":document.getElementById('name').value,
"email":document.getElementById('email').value,
<?php
// WePay PHP SDK - http://git.io/mY7iQQ
require 'wepay.php';
// application settings
$account_id = 123456789;
$client_id = 123456789;
$client_secret = "1a3b5c7d9";
$access_token = "STAGE_8a19aff55b85a436dad5cd1386db1999437facb5914b494f4da5f206a56a5d20";
$ curl https://stage.wepayapi.com/v2/checkout/create \
-H "Authorization: Bearer STAGE_8a19aff55b85a436dad5cd1386db1999437facb5914b494f4da5f206a56a5d20" \
-d "account_id=123456789" \
-d "amount=25.50" \
-d "currency=USD" \
-d "short_description=A brand new soccer ball" \
-d "type=goods" \
-d "payment_method[type]=credit_card" \
-d "payment_method[credit_card][id]=123"
# WePay Ruby SDK - http://git.io/a_c2uQ
require 'wepay'
# application settings
account_id = 123456789
client_id = 123456789
client_secret = '1a3b5c7d9'
access_token = 'STAGE_8a19aff55b85a436dad5cd1386db1999437facb5914b494f4da5f206a56a5d20'
# credit card to charge
# WePay Python SDK - http://git.io/v7Y1jA
from wepay import WePay
# application settings
account_id = 123456789
access_token = 'STAGE_8a19aff55b85a436dad5cd1386db1999437facb5914b494f4da5f206a56a5d20'
production = False
# credit card id to charge
credit_card_id = 123456789
<?php
// WePay PHP SDK - http://git.io/mY7iQQ
require 'wepay.php';
// oauth2 parameters
$code = $_GET['code']; // the code parameter from step 2
$redirect_uri = "http://www.example.com/oauth2_redirect_uri"; // this is the redirect_uri you used in step 1
// application settings
$client_id = 123456789;
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'
# oauth2 parameters
code = params[:code]; # the code parameter from step 2
redirect_uri = "http://www.example.com/oauth2_redirect_uri"; # this is the redirect_uri you used in step 1
# application settings
client_id = 123456789
client_secret = '1a3b5c7d9'
# WePay Python SDK - http://git.io/v7Y1jA
from wepay import WePay
# oauth2 parameters
code = '52sdga231sddd213jj9a'; # the code parameter from step 2
redirect_uri = "http://www.example.com/oauth2_redirect_uri"; # this is the redirect_uri you used in step 1
# application settings
client_id = 123456789
client_secret = '1a3b5c7d9'
<?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