<?php

// Venmo Payment Links Example
include '../venmo.class.php';
include 'venmo.config.php';
try {
    $v = new Venmo();
    $v->setAccessToken(EXAMPLE_USERS_ACCESS_TOKEN);
    $v->setEnviroment("SANDBOX");
    echo "Venmo Payment Link Example\r\n";
    echo "-------------------\r\n\r\n";
    // generatePaymentLink
    $type = "pay";
    $recipients = array("*****@*****.**", "646.863.9557", "john");
    $amount = "1.25";
    $note = "Test Note";
    $audience = "private";
    $sharing = "f";
    echo $v->generatePaymentLink($type, $recipients, $amount, $note, $audience, $sharing);
} catch (Exception $e) {
    echo "ERROR:venmo.payment.links.example.php";
    print_r($e);
}
<?php

// Venmo Payments Example
include '../venmo.class.php';
include 'venmo.config.php';
try {
    $v = new Venmo();
    $v->setAccessToken(EXAMPLE_USERS_ACCESS_TOKEN);
    $v->setEnviroment("SANDBOX");
    echo "Venmo Payments Example\r\n";
    echo "-------------------\r\n\r\n";
    // sendPaymentCharge
    echo "sendPaymentCharge Test - User ID\r\nResponse: ";
    $to = array("user_id" => "145434160922624933");
    // Sandbox user
    print_r($v->sendPaymentCharge($to, '0.10', 'sendPaymentCharge Test - User ID', 'private'));
    echo "-------------------\r\n\r\n";
    // sendPaymentCharge
    echo "sendPaymentCharge Test - Email\r\nResponse: ";
    $to = array("email" => "*****@*****.**");
    // Sandbox user
    print_r($v->sendPaymentCharge($to, '0.20', 'sendPaymentCharge Test - Email', 'friends'));
    echo "-------------------\r\n\r\n";
    // sendPaymentCharge
    echo "sendPaymentCharge Test - Phone\r\nResponse: ";
    $to = array("phone" => "15555555555");
    // Sandbox user
    print_r($v->sendPaymentCharge($to, '0.30', 'sendPaymentCharge Test - Phone', 'public'));
    echo "-------------------\r\n\r\n";
    // getRecentPayments
    echo "getRecentPayments Test\r\nResponse: ";
示例#3
0
/*
 * Server side integration for Venmo API
 *
 * Please make sure to define client_id, client_secret and scopes before getting started
 *
 * For full list of scopes, please see Venmo API documentation. By default, this class implements the bare
 * minimum set of scopes to send money from one user to another.
 *
 * 1) Call getAuthURL from app and direct user to that URL in app
 * 2) Call exchangeToken and pass query param "code" returned from first request
 * 3) On success, store the entire object so that you have access to the access and refresh tokens
 * 4) Call getUser or Payment request as needed
 *
 * See https://developer.venmo.com for more info
 *
 * To Do
 * 1) Error Handling - https://developer.venmo.com/docs/errors
 * 2) Yii wrapper
 */
include 'Venmo.php';
$v = new Venmo();
$user_id = 1.4543416092262493E+17;
$email = '*****@*****.**';
$phone = 15555555555.0;
echo $v->getAuthURL();
echo "\r\n -----Done----- \r\n";
echo $v->exchangeToken();
echo $v->getUser();
echo $v->sendPayment();
echo $v->refreshAccessToken();
<?php

// Venmo Users Example
include '../venmo.class.php';
include 'venmo.config.php';
try {
    $v = new Venmo();
    $v->setAccessToken(EXAMPLE_USERS_ACCESS_TOKEN);
    $v->setEnviroment("SANDBOX");
    echo "Venmo Users Example\r\n";
    echo "-------------------\r\n\r\n";
    // getCurrentUserInfo
    echo "getCurrentUserInfo Test\r\nResponse: ";
    print_r($v->getCurrentUserInfo());
    echo "-------------------\r\n\r\n";
    // getUserFriends
    echo "getUserFriends Test - Current User\r\nResponse: ";
    print_r($v->getUserFriends("me"));
    // getUserInfo
    echo "getCurrentUserInfo Test - " . EXAMPLE_USERS_USER_ID . "\r\nResponse: ";
    print_r($v->getUserInfo(EXAMPLE_USERS_USER_ID));
    echo "-------------------\r\n\r\n";
    // getUserFriends
    echo "getUserFriends Test - " . EXAMPLE_USERS_USER_ID . "\r\nResponse: ";
    print_r($v->getUserFriends(EXAMPLE_USERS_USER_ID));
} catch (Exception $e) {
    echo "ERROR:venmo.users.example.php";
    print_r($e);
}