Skip to content

Instantly share code, notes, and snippets.

@xcommerce-gists
xcommerce-gists / Coupon.php
Created December 11, 2012 21:01
Magento coupon code generator sample configuration file
<?php
class CouponDemo_AutoGen_Model_Api2_Coupon extends Mage_Api2_Model_Resource
{
}
@xcommerce-gists
xcommerce-gists / DoExpressCheckoutPayment.curl
Created November 20, 2012 21:55
How to Create One-Time Payments Using Express Checkout.curl
curl -s --insecure https://api-3t.sandbox.paypal.com/nvp -d
"USER=<callerID>
&PWD=<callerPswd>
&SIGNATURE=<callerSig>
&METHOD=DoExpressCheckoutPayment
&VERSION=93
&TOKEN=<tokenValue>
&PAYERID=<payerID> # customer's unique PayPal ID
&PAYMENTREQUEST_0_PAYMENTACTION=SALE # payment type
&PAYMENTREQUEST_0_AMT=19.95 # transaction amount
@xcommerce-gists
xcommerce-gists / rest_test.php
Created November 20, 2012 02:02
Magento coupon code generator test script
<?php
/********************************************************************
File name: rest_test.php
Description:
A PHP test script that calls the Coupon AutoGen extension
to Magento's REST API.
The Coupon AutoGen API takes:
-- the rule ID of the &quot;Generate Coupons&quot; rule to execute
-- the number of coupon codes to generate
-- the length of each coupon code
@xcommerce-gists
xcommerce-gists / V1.php
Last active October 12, 2015 21:39
Magento coupon code generator sample configuration file
<?php
/* Coupon AutoGen REST API
*
* @category CouponDemo
* @package CouponDemo_AutoGen
* @author Chuck Hudson (used with permission). For more recipes, see Chuck's book http://shop.oreilly.com/product/0636920023968.do
*/
class CouponDemo_AutoGen_Model_Api2_Coupon_Rest_Admin_V1 extends CouponDemo_AutoGen_Model_Api2_Coupon
{
@xcommerce-gists
xcommerce-gists / api2.xml
Created November 16, 2012 18:13
Magento coupon code generator sample configuration file
<config>
<api2>
<resource_groups>
<autogen translate="title" module="CouponDemo_AutoGen">
<title>CouponDemo API</title>
<sort_order>10</sort_order>
</autogen>
</resource_groups>
<resources>
<autogen translate="title" module="CouponDemo_AutoGen">
@xcommerce-gists
xcommerce-gists / config.xml
Created November 16, 2012 18:08
Magento coupon code generator sample configuration file
<?xml version="1.0"?>
<config>
<modules>
<CouponDemo_AutoGen>
<version>0.1.0</version>
</CouponDemo_AutoGen>
</modules>
<global>
<models>
<autogen>
@xcommerce-gists
xcommerce-gists / CouponDemo_AutoGen.xml
Created November 15, 2012 21:02
Magento coupon code generator sample configuration file
<?xml version="1.0"?>
<config>
<modules>
<CouponDemo_AutoGen>
<active>true</active>
<codePool>community</codePool>
</CouponDemo_AutoGen>
</modules>
</config>
@xcommerce-gists
xcommerce-gists / Pay
Created November 14, 2012 23:23
How to Make a Parallel Payment Using Adaptive Payments.curl
HTTP Headers
------------
-H "X-PAYPAL-SECURITY-USERID: insert_developer_user_name_here"
-H "X-PAYPAL-SECURITY-PASSWORD: insert_developer_password_here"
-H "X-PAYPAL-SECURITY-SIGNATURE: insert_developer_signature_here"
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV"
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV"
-H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T" #Standard Sandbox App ID
Endpoint
@xcommerce-gists
xcommerce-gists / getAccessToken-request-php
Created November 3, 2012 17:16
PayPalAccessOpenIDConnectOAuth.PHP
//download the complete php code sample from https://github.com/paypal/paypal-access
/**
* 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.
*
*/
@xcommerce-gists
xcommerce-gists / getAccessToken-request-cURL
Last active August 2, 2019 09:19
PayPalAccessOpenIDConnectOAuth.cURL
curl https://api.paypal.com/v1/identity/openidconnect/tokenservice \
-u "<your_app_id>:<your_app_secret>" \
-d "client_id=&grant_type=authorization_code&code=<code>&redirect_uri=<urlencoded_return_url>"