Giter VIP home page Giter VIP logo

fastspring-php's Introduction

<title>Documentation FastSpring Subscription API for PHP</title>

About FastSpring

FastSpring offers an innovative e-commerce engine designed to overcome ease of use, customer service, and cost issues that have plagued software e-commerce companies. We employ a customer-driven, iterative and collaborative Agile development process.

About FastSpring Subscription API for PHP

The FastSpring Subscription API for PHP allows for easy integration with FastSpring's subscription services. There is a example web application to demonstrate the usage of the API. All source code is released under the MIT license. It is open to contributions and its use is unrestricted.

How-to integrate

Read our Integration Guide for information on integrating your PHP application with FastSpring's subscription service.

#FastSpring API for PHP#

Introduction

FastSpring's Subscription API for PHP provides an interface for integrating PHP applications with FastSpring's subscription services. It provides the necessary CRUD operations needed to manage subscriptions.

Class Library

The FastSpring Subscription API class library provides the CRUD operations in a single class called FastSpring. This class and other classes used to pass the data in and out of the APIs are described below.

class FastSpring {
	public $test_mode = false;
	
	public function __construct($store_id, $api_username, $api_password) { ... }
	
	public function createSubscription($product_ref, $customer_ref) { ... }
	
	public function getSubscription($subscription_ref) { ... }
	
	public function updateSubscription($subscriptionUpdate) { ... }
	
	public function cancelSubscription($subscription_ref) { ... }
	
	public function renewSubscription($subscription_ref) { ... }
}

How-to add the FastSpring Subscription API to your PHP application

All that is needed to start using the FastSpring Subscription API in your PHP application is to include the fastspring.php file from your PHP files.

Then you instantiate a new FastSpring object with the parameters that match your store's setup.

  • $store_id
  • $api_username
  • $api_password

Example

$fastspring = new FastSpring("your_store_id", "your_api_username", "your_api_password");

class FsprgSubscription

public $status;
public $statusChanged;
public $statusReason;
public $cancelable;
public $reference;
public $test;
public $customer;
public $customerUrl;
public $productName;
public $tags;
public $quantity;

class FsprgCustomer

public $firstName;
public $lastName;
public $company;
public $email;
public $phoneNumber;

class FsprgSubscriptionUpdate

public function __construct($subscription_ref) { ... }	

public $productPath;
public $quantity;
public $tags;
public $noEndDate;
public $coupon;
public $discountDuration;
public $proration;

class FsprgException

public $httpStatusCode;
public $errorCode;

Example1 PHP Application

Demonstrates the usage of the FastSpring Subscription API in a simple web application that has a subscription page. You will need to have an existing FastSpring store configured for subscriptions. The following needs to be configured in order to use this example:

  • A subscription product
  • Subscription Activated Notification
  • Subscription Deactivated Notification

You need to modify include.php to modify the following values to match your store's settings:

  • $store_id
  • $api_username
  • $api_password
  • $test_mode
  • product_id

You also need to set the $privateKey variable in activate.php and deactivate.php. This private key needs to match the private key in the Security tab of the Subscription Activated Notification and Subscription Deactivated Notification respectively.

Please see example1/INSTRUCTIONS.txt for full, step by step configuration.

fastspring-php's People

Contributors

johnnye avatar rdewell avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.