Skip to content

Instantly share code, notes, and snippets.

View jaypatel512's full-sized avatar

Jay jaypatel512

  • PayPal
  • Austin TX
View GitHub Profile
<?php
// 1. Autoload the SDK Package. This will include all the files and classes to your autoloader
require __DIR__ . '/PayPal-PHP-SDK/autoload.php';
// 2. Provide your Secret Key. Replace the given one with your app clientId, and Secret
// https://developer.paypal.com/webapps/developer/applications/myapps
$apiContext = new \PayPal\Rest\ApiContext(
new \PayPal\Auth\OAuthTokenCredential(
'AYSq3RDGsmBLJE-otTkBtM-jBRd1TCQwFf9RGfwddNXWz0uFU9ztymylOhRS', // ClientID
@jaypatel512
jaypatel512 / second.php
Last active September 28, 2020 18:00
Adding SDK Configurations to enable Logging: https://github.com/paypal/PayPal-PHP-SDK/wiki/Adding-Configurations
<?php
// 1. Autoload the SDK Package. This will include all the files and classes to your autoloader
require __DIR__ . '/PayPal-PHP-SDK/autoload.php';
// 2. Provide your Secret Key. Replace the given one with your app clientId, and Secret
// https://developer.paypal.com/webapps/developer/applications/myapps
$apiContext = new \PayPal\Rest\ApiContext(
new \PayPal\Auth\OAuthTokenCredential(
'AYSq3RDGsmBLJE-otTkBtM-jBRd1TCQwFf9RGfwddNXWz0uFU9ztymylOhRS', // ClientID
@jaypatel512
jaypatel512 / sdk_config.ini
Last active November 18, 2015 10:25
SDK Configurations
;## This is an example configuration file for the SDK.
;## The sample scripts configure the SDK dynamically
;## but you can choose to go for file based configuration
;## in simpler apps (See bootstrap.php for more).
[Account]
acct1.ClientId = AYSq3RDGsmBLJE-otTkBtM-jBRd1TCQwFf9RGfwddNXWz0uFU9ztymylOhRS
acct1.ClientSecret = EGnHDxD_qRPdaLdZz8iCr8N7_MzF-YHPTkjs6NKYQvQSBngp4PTTVWkPZRbL
;Connection Information
[Http]
// 1. Autoload the SDK Package. This will include all the files and classes to your autoloader
require __DIR__ . '/PayPal-PHP-SDK/autoload.php';
// 2. Define PP_CONFIG_PATH directory
if(!defined("PP_CONFIG_PATH")) {
define("PP_CONFIG_PATH", __DIR__);
}
// 3. Lets try to create a Payment
// https://developer.paypal.com/docs/api/payments/#payment_create
@jaypatel512
jaypatel512 / start.sh
Created February 20, 2015 18:38
Quick Command to Start PayPal PHP SDK Sample
dirname=PayPalPHPSDK$(date +%s)
mkdir $dirname
cd $dirname
php -r "readfile('https://getcomposer.org/installer');" | php
php composer.phar require paypal/rest-api-sdk-php
php -f vendor/paypal/rest-api-sdk-php/sample/index.php
<?php
// Just for error purposes
error_reporting(E_ALL);
ini_set('display_errors', '1');
// 1. Autoload the SDK Package. This will include all the files and classes to your autoloader
require __DIR__ . '/PayPal-PHP-SDK/autoload.php';
// 2. Provide your Secret Key. Replace the given one with your app clientId, and Secret
CREATE DATABASE IF NOT EXISTS `tilupay` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `tilupay`;
-- MySQL dump 10.13 Distrib 5.6.19, for osx10.7 (i386)
--
-- Host: localhost Database: tilupay
-- ------------------------------------------------------
-- Server version 5.5.42
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
// ### Create Patch Request
List<Patch> patchRequest = new ArrayList<Patch>();
// ### Amount
// Let's update the payment amount as an example.
Amount amount = new Amount();
amount.setCurrency("USD");
// Total must be equal to sum of shipping, tax and subtotal.
amount.setTotal("17.50");
amount.setDetails(new Details().setShipping("11.50").setTax("1")
import com.paypal.api.payments.CreditCard;
import com.paypal.base.rest.APIContext;
import com.paypal.base.rest.PayPalRESTException;
public class JavaSampleOne {
public static void main(String[] args) {
// Replace these values with your clientId and secret. You can use these to get started right now.
String clientId = "AYSq3RDGsmBLJE-otTkBtM-jBRd1TCQwFf9RGfwddNXWz0uFU9ztymylOhRS";
String clientSecret = "EGnHDxD_qRPdaLdZz8iCr8N7_MzF-YHPTkjs6NKYQvQSBngp4PTTVWkPZRbL";
0xfeD8fe26C923241407cA36F39ec34A5DCFDE0fec