API Applied Programming Interface
|
This page describes how to connect to phpYellow with a Payment Gateway. This is only needed if you wish a second payment gateway. phpYellow Pro EditionTM includes a default Paypal subscription based service included with every Pro Edition. All you do is add your paypal address and the service is automatically enabled. If you wish to add another payment gateway then technical details follow. |
Payment - Technical Specifications
This page contains information or links to the following:- Overview
- Data out
- Data in
- Affected files
- How to add other gateways
- Sample form for posting to your gateway
- Offer to connect payment gateway
Overview

phpYellow sends data to the gateway. At the gateway the customer
enters the payment data. The transaction is processed by the gateway.
The transaction is approved or declined.
Approval decision
If the transaction is approved then the gateway should be configured to automatically post back to phpyellow so that the customer listing can be updated.Outcome of a decline
If the transaction is declined the reason for the decline should be made clear to the customer. The processing may then [optionally] return to a phpyellow page [example:sorry.php].Data out
Payment scripts on phpyellow make the submission [post] to the gateway containing the phpyellow and gateway specific data going out. Following is the data required by phpyellow to be sent out:Table of data out variables
| Variable name | data type | required? | example |
|---|---|---|---|
| ckey | integer | yes | 1234 |
| rank | integer | yes | 4 |
| duration* | integer | yes | 12 |
* The value for the variable named duration is in months, not days
Data out for a specific gateway
The data out for a specific gateway varies with the gateway. See your gateway implementation guide for details on the data you must send to your gateway. At minimum the gateway will require a total price to be charged, and will also collect contact and other payment information at the gateway.| Variable name | data type | required? | example |
|---|---|---|---|
| amount | float | no* | 98.76 |
* the variable called amount is NOT required by phpyellow however amount is normally required by the gateway. Financial transaction data is NOT saved by phpyellow. This data is typically saved on your gateway.
Data in
The data sent back in to phpyellow from the gateway must contain the variables called:- ckey
- rank
- duration
Affected files and their functions
Following is a list of files used in the payment process and the function the file performs:Files used to send data out
- buy.php - manipulates data and routes the payment choice
- checkout.php - customer makes listing, duration and payment choices
- duration.php - the listing duration choices
- paymentMethodsList.php - the pay method choices
- data_out.php - final phpyellow form used to send transaction to the gateway
Files used to accept data in
- data_in.php - accepts gateway approval, updates customer listing
- sorry.php - page shown with a declined transaction [optional]
How to add other gateways
Other gateways will need to have a url to send the transaction to, as well as gateway specific data.Gateway URL
The url to post data to may be one of:- Paypal or
- a phpyellow internal test url, or
- your gateway url
case"Credit Card by Internet":
if(!isset($_POST['formActionValue'])) { // if there is no value, then give it a value
$_POST['formActionValue'] = "Enter your gateway url value here in buy.php";
}
// ... more code ...
Gateway specific data may include hidden html variables and preprocessed code.
Hidden html variables
- open pro_gateway_variables.php
- create all of the variables your gateway requires using html hidden input types
example
<input type="hidden" name="account" value="12345">
- save pro_gateway_variables.php on your web server in your /phpyellow folder
Sample form for posting to your gateway
A sample form for posting to your gateway is data_out.php included with every Pro Edition purchase.
Generating a unique product id for each listing
How a product_id may be generated - used with 2checkout.com recurring billing - example only
Rank Position Duration (months) product_id 0 Bronze 3 1 0 Bronze 6 2 0 Bronze 12 3 1 Silver 3 4 1 Silver 6 5 1 Silver 12 6 2 Gold 3 7 2 Gold 6 8 2 Gold 12 9 3 Mini-webpage 3 10 3 Mini-webpage 6 11 3 Mini-webpage 12 12 4 Sponsor 3 13 4 Sponsor 6 14 4 Sponsor 12 15