developer_guide:developer_guide:usingcallback

Post-backs

What is a Post-back?

A Post-back, also known as a “call back” or “silent post”, is a method by which your app can react to events that occur during the Subscription Life cycle (e.g. a new subscription, a recurring payment is declined, a subscription is upgraded, etc.). For example, your blog or iPhone app can use post-backs to grant customers access to special content, and restrict access to others.

This method is being depreciated. We are currently rolling out WebHooks, which are easier to use and have more flexibility. Once WebHooks are released we will announce them, but in the meantime Post-backs remain a highly effective and functional option.

How it works

A post-back URL is saved in your Merchant Settings. The URL points to a post-back script in your app. We send a post-back message to your post-back script when there is an event (e.g. a sign-up). Your script uses the information in the post-back message to trigger an action (e.g. enable content to a new user).

A full list of events and sample scripts are available.

Post-back URL

The Post-back URL, which is set in the Notification Settings area of the Merchant Center (separately for each store), defines the location of script on your Web site or App that contains code designed by you to interpret and react to the information provided by SubscriptionBridge in the post-back message.

Here the steps required to configure your Post-back URL:

  1. Log into the Merchant Center.
  2. Navigate to “Notification Settings”
  3. Under “Advanced Settings” find “Post-back URL
  4. Type your URL into the box. We recommend using a secure URL.
  5. Click “Save Notification Settings” at the bottom of the page.

Post-back Script (Any programming language)

The script located at the Post-back URL can be written in any programming language capable of receiving and parsing XML data. We have sample post-back scripts in our samples section.

Sample Post-back Script

  • PHP
  • ASP

Post-back Message

The post-back message is plain old XML so it is compatible with all programming languages. The XML contains the Subscription ID (GUID) and the Event Code (Event_Code).

Here is an example message:

* Sample XML:

<?xml version="1.0" encoding="utf-8"?>
<SB_Callback>
<GUID>Subscription ID</GUID>
<Event_Code>Event Code</Event_Code>
</SB_Callback>

View a list of XML notifications sent by SubscriptionBridge to the Callback URL to see what kind of information SubscriptionBridge will be sending to your script.

Testing Post-backs

You can test a Post-back for a Subscription directly from the Merchant Center. Just navigate to any Subscription's details page. From there click the “More” button, then click “Test Post-backs”. By this method you can test your Post-back script is working properly.

developer_guide/developer_guide/usingcallback.txt · Last modified: 2012/02/26 02:10 by matt