Skip to content

Instantly share code, notes, and snippets.

@xcommerce-gists
xcommerce-gists / step1.php
Created October 1, 2012 00:20
Step 1 in the x.commerce demo application
F3::route('POST /cart_order',
function() {
//gets the schema URI, parses it
$json_schema = Web::http('GET '.F3::get('SESSION.cart_uri'));
error_log($json_schema);
$avro_schema = AvroSchema::parse($json_schema);
$datum_writer = new AvroIODatumWriter($avro_schema);
$write_io = new AvroStringIO();
$encoder = new AvroIOBinaryEncoder($write_io);
@xcommerce-gists
xcommerce-gists / DoEC-parallel.curl
Created September 26, 2012 18:57
How to Make Parallel Payments Using Express Checkout.curl
curl -s --insecure https://api-3t.sandbox.paypal.com/nvp -d
"USER=<Caller_ID>
&PWD=<Caller_Pswd>
&SIGNATURE=<Caller_Sig>
&METHOD=DoExpressCheckoutPayment
&VERSION=93
&TOKEN=<Token> # TOKEN value returned from SetExpressCheckout
&PAYERID=<PayerID> # PAYERID value returned from GetExpressCheckoutDetails
&PAYMENTREQUEST_0_AMT=250 # first payment details
&PAYMENTREQUEST_0_CURRENCYCODE=USD
@xcommerce-gists
xcommerce-gists / Test HTML code.html
Created September 20, 2012 20:10
How to Test PayPal Payments Standard Buttons.html
<!DOCTYPE html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>Testing a PayPal Payments Standard Button</title>
</head>
<body>
<h2>Buy Strings!</h2>
@xcommerce-gists
xcommerce-gists / RefundTransaction
Created September 19, 2012 22:01
How to Make a Basic Refund Using the Merchant API.curl
Request
-------
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=merchant_user_name
&PWD=merchant_password
&SIGNATURE=merchant_signature
&METHOD=RefundTransaction
&VERSION=94
@xcommerce-gists
xcommerce-gists / CreateRecurringPaymentsProfile
Created September 13, 2012 18:34
How to Offer a Free Trial and Recurring Payments Using Express Checkout.curl
Request
-------
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=insert_merchant_user_name_here
&PWD=insert_merchant_password_here
&SIGNATURE=insert_merchant_signature_value_here
&METHOD=CreateRecurringPaymentsProfile
&VERSION=94
@xcommerce-gists
xcommerce-gists / DoDirectPayment
Created September 11, 2012 21:07
How to Run a Reference Transaction Using Direct Payment.curl
Request
-------
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=insert_merchant_user_name_here
&PWD=insert_merchant_password_here
&SIGNATURE=insert_merchant_signature_value_here
&METHOD=DoDirectPayment
&VERSION=86
@xcommerce-gists
xcommerce-gists / DoExpressCheckoutPayment.php
Created September 6, 2012 20:36
How to Use Express Checkout for One-Time Payments.php
require_once('services/PayPalApi/PayPalAPIInterfaceServiceService.php');
/* setup payment details */
orderTotal = new BasicAmountType( '-your-currency-code-', '-your-amount-');
$PaymentDetails= new PaymentDetailsType();
$PaymentDetails->OrderTotal = $orderTotal;
/* create DoExpressCheckout request details */
$DoECRequestDetails = new DoExpressCheckoutPaymentRequestDetailsType();
$DoECRequestDetails->PayerID = '-payer-id-from-get-EC-call';
@xcommerce-gists
xcommerce-gists / auth.php
Created September 5, 2012 15:23
PayPalAccessOpenIDConnect.PHP
/**
* Get Access Token
*
* After the user is forwarded back to the application callback (defined in
* the application at devportal.x.com) and the code parameter is available on
* the query string, exchange the code parameter for an access token.
*
*/
public function get_access_token(){
$code = $_GET['code'];
@xcommerce-gists
xcommerce-gists / DoExpressCheckoutPayment
Created August 29, 2012 19:37
How to Use Express Checkout for One-Time Payments.curl
Request
-------
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=insert_merchant_user_name_here
&PWD=insert_merchant_password_here
&SIGNATURE=insert_merchant_signature_value_here
&METHOD=DoExpressCheckoutPayment
&VERSION=86
@xcommerce-gists
xcommerce-gists / CreateBillingAgreement
Created August 28, 2012 21:28
How to Set Up a Reference Transaction Using Express Checkout.curl
Request
-------
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=insert_merchant_user_name_here
&PWD=insert_merchant_password_here
&SIGNATURE=insert_merchant_signature_value_here
&METHOD=CreateBillingAgreement
&VERSION=86