Wednesday, March 23, 2011

AlertPay - Advanced Integration Guide

Introduction

Advanced Integration is for sellers who want more flexibility when creating payment buttons. Advanced Integration facilitates the creation of dynamic "Buy Now" buttons found in many shopping cart and e-commerce solutions, though some knowledge of HTML coding is required.

Advanced Button Creation

When creating an Advanced Button, you must use the proper parameters in the HTML form of your payment button. Contrary to the Standard Button, which only contains the ap_productid and ap_quantity variables, the Advanced Button requires the use of additional parameters so your checkout page more precisely describes the item you are selling. Depending on the values and parameters sent to the AlertPay checkout page, each buyer will see different information.

Anatomy of an Advanced Button code

To understand how an Advanced Button is processed during checkout, we will use the following "Buy Now" button code as an example:
<form method="post" action="https://www.alertpay.com/PayProcess.aspx" >

   <input type="hidden" name="ap_merchant" value="apdevforum@gmail.com"/>

    <input type="hidden" name="ap_purchasetype" value="item"/>

    <input type="hidden" name="ap_itemname" value="MP3 Player"/>

    <input type="hidden" name="ap_amount" value="50"/>

    <input type="hidden" name="ap_currency" value="USD"/>

            

    <input type="image" src="https://www.alertpay.com//PayNow/4F59239578EA46C1AD168BA6E9BD2067g.gif"/>

</form>
The sample code above transmits the parameters (shown in boldface) and their value to our checkout page using the POST method: https://www.alertpay.com/PayProcess.aspx.
The five parameters that are present in the code are the minimum required parameters for the Advanced payment button to function properly. If any of those variables are missing, an error message will be displayed rather than a regular checkout page. Clicking on the "Buy Now" button will bring the customer to the following page:
The five parameters that are sent to our checkout page influences what is displayed to the buyer on the same page:
ap_merchant: The value, apdevforum@gmail.com, represents the seller’s AlertPay account and where the payment will be sent to. The email address must be in the proper format and must be registered in the AlertPay network or an error message will be returned. AlertPay will capture and display the business name associated with the email address.
ap_purchasetype: The value can be item, service, item-goods or item-auction since you are only selling a single item at a time to the customer. However, if the item’s value were to be changed to subscription, the necessary parameters to create a proper "Subscribe Now" button must be included. Please refer to the Subscription Button section for more information. The ap_purchasetype is not displayed on the checkout page, but its value will be returned in the IPN messages for you to capture and process.
ap_itemname: The names of all items or services sold must be displayed on the checkout page so the buyer knows what they are purchasing. In our case, "MP3 Player" is the value that is provided and shown on the checkout page.
ap_amount: The value provided for this parameter is the price of the item or service. The amount must be greater or equal to the minimum amount allowed by AlertPay.
ap_currency: The value of this parameter is a three-letter ISO-4217 code for a given currency (For example, Canadian currency is represented as CAD). The value will specify the currency in which the payment will be made through the button.

Other button parameters

The five aforementioned variables are the basic parameters that must be present in an Advanced button. Payment buttons can be further customized to include extra parameters in the HTML form. For example, the bold elements in the following HTML form code are all optional parameters that may affect the behavior of the button on the checkout page:
<form method="post" action="https://www.alertpay.com/PayProcess.aspx" >

    <input type="hidden" name="ap_merchant" value="apdevforum@gmail.com"/>

    <input type="hidden" name="ap_purchasetype" value="item-goods"/>

    <input type="hidden" name="ap_itemname" value="MP3 Player"/>

    <input type="hidden" name="ap_amount" value="50"/>

    <input type="hidden" name="ap_currency" value="USD"/>

    

    <input type="hidden" name="ap_quantity" value="2"/>

    <input type="hidden" name="ap_itemcode" value="XYZ123"/>

    <input type="hidden" name="ap_description" value="Lorem ipsum dolor sit amet. Proin eleifend congue congue."/>

    <input type="hidden" name="ap_returnurl" value="http://www.example.com/thankyou.html"/>

    <input type="hidden" name="ap_cancelurl" value="http://www.example.com/cancel.html"/>

    

    <input type="hidden" name="ap_taxamount" value="2.49"/>

    <input type="hidden" name="ap_additionalcharges" value="1.19"/>

    <input type="hidden" name="ap_shippingcharges" value="7.99"/> 

        

    <input type="hidden" name="ap_discountamount" value="4.99"/> 

    <input type="hidden" name="apc_1" value="Blue"/>

    

    <input type="image" src="https://www.alertpay.com//PayNow/4F59239578EA46C1AD168BA6E9BD2067g.gif"/>

</form>    
The following image shows the effect that these additional parameters have on the "Buy Now" button once a buyer clicks on it. AlertPay’s checkout page will display the details that correspond to the additional values:
You may include other variables to further customize your button so that it does what you want it to. For a complete listing of these parameters and their expected values, please refer to the Button Parameters Table.

Using Form Pre-Filling

Since you can accept payments from people who do not have an AlertPay account, you can easily send information related to a buyer to the form on our checkout page. If you have already captured the necessary information before the customer clicks on the payment button, such as their name and address, you can pre-fill the fields on the checkout page by adding the following optional parameters to your Standard or Advanced buttons:
ap_fname

ap_lname

ap_contactemail

ap_contactphone

ap_addressline1

ap_addressline2

ap_city

ap_stateprovince

ap_zippostalcode

ap_country
From the information you capture when directing a customer to the checkout page, your website must dynamically generate the values for each field listed above when a customer clicks on a payment button.
Here is an example of an Advanced “Buy Now” button’s HTML code with optional form pre-filling parameters:
<form method="post" action="https://www.alertpay.com/PayProcess.aspx" >

    

    <input type="hidden" name="ap_merchant" value="apdevforum@gmail.com"/>

    <input type="hidden" name="ap_purchasetype" value="item-goods"/>

    <input type="hidden" name="ap_itemname" value="MP3 Player"/>

    <input type="hidden" name="ap_amount" value="10"/>

    <input type="hidden" name="ap_currency" value="USD"/>

    

    <input type="hidden" name="ap_fname" value="John" />

    <input type="hidden" name="ap_lname" value="Doe" />

    <input type="hidden" name="ap_contactemail" value="email@domain.com" />

    <input type="hidden" name="ap_contactphone" value="5555555555" />

    <input type="hidden" name="ap_addressline1" value="123 Test Street" />

    <input type="hidden" name="ap_addressline2" value="Apt #101" />

    <input type="hidden" name="ap_city" value="Montreal" />

    <input type="hidden" name="ap_stateprovince" value="QC" />

    <input type="hidden" name="ap_zippostalcode" value="H0H0H0" />

    <input type="hidden" name="ap_country" value="CAN" />

    

    <input type="image" name="ap_image" src="https://www.alertpay.com//PayNow/
4F59239578EA46C1AD168BA6E9BD2067g.gif"/>   

</form>
The previous code will generate the following on our checkout page:
Please refer to the Form Pre-Fill parameters table for a complete description of each variable.

Multi-Item Button

The Multi-Item Button’s main functionality is to further enhance your shopping cart integration by listing the details of individual items on the AlertPay checkout page. Alternatively, you can easily build product packages with a Multi-Item Button and sell your goods or services as bundles.
When using the Multi-Item Button, all five required HTML variables are the same as the ones used for the single-item button. From those five parameters, the only variable that will differ is ap_itemname, which will have a _x added to it. The following variables will also have a _x added to the end of their respective names:
ap_itemname_x

ap_description_x

ap_itemcode_x

ap_amount_x

ap_quantity_x
The appended _x is the item number. The first element will keep its original name and will not have number appended to it. The second element will start with 1 and increasing by one for each additional item.
The item number specified by _x value ties the optional variables, such as the ap_description, to the corresponding ap_itemname variable, which is required.
To ensure that your items will be recognized, the _x values must continuously increase by increments of one. Skipping an item number will result in an error on the AlertPay checkout page. For example, if you skip from item #1 to item #3, an error will occur.

Currency of the Multi-Item Button

The currency of the Multi-Item Button is not item-specific and is defined for the entire set of items by the ap_currency variable. It will keep its original name, so there is no need to add _x to the ap_currency variable. The currency is applied to all the monetary variables in the payment button: ap_amount, ap_taxamount, ap_discountamount, ap_additionalcharges, ap_shippingcharges, ap_setupamount and ap_trialamount.

Passing multiple items to AlertPay

The following HTML code for a Multi-Item Button will pass three different items to the checkout page. Information on each item will be displayed on a different line on the checkout page:
<form method="post" action="https://www.alertpay.com/PayProcess.aspx" >



<input type="hidden" name="ap_purchasetype" value="item"/> 

<input type="hidden" name="ap_merchant" value="forum@gmail.com"/> 

<input type="hidden" name="ap_currency" value="USD"/>



<input type="hidden" name="ap_itemname_1" value="Item 01"/> 

<input type="hidden" name="ap_itemname_2" value="Item 02"/> 

<input type="hidden" name="ap_itemname_3" value="Item 03"/> 



<input type="hidden" name="ap_description_1" value="Lorem ipsum"/>

<input type="hidden" name="ap_description_2" value="Na misnet par"/>

<input type="hidden" name="ap_description_3" value="Lun der ter"/>



<input type="hidden" name="ap_itemcode_1" value="7462"/> 

<input type="hidden" name="ap_itemcode_2" value="5955"/> 

<input type="hidden" name="ap_itemcode_3" value="8943"/> 



<input type="hidden" name="ap_quantity_1" value="1"/> 

<input type="hidden" name="ap_quantity_2" value="4"/> 

<input type="hidden" name="ap_quantity_3" value="2"/> 



<input type="hidden" name="ap_amount_1" value="35.00"/> 

<input type="hidden" name="ap_amount_2" value="24.00"/> 

<input type="hidden" name="ap_amount_3" value="67.00"/>



<input type="hidden" name="ap_returnurl" value="https://www.alertpay.com"/> 

<input type="hidden" name="ap_cancelurl" value="https://www.alertpay.com"/> 

<input type="image" name="ap_image" src="https://www.alertpay.com//PayNow/
4F59239578EA46C1AD168BA6E9BD2067g.gif"/>



</form>
The HTML code above will generate the following output on the AlertPay checkout page:
Please see the Multi-Item Button document for a description of its parameters and for further information on this feature.

Advanced Button Security & IPN

Anyone can see the HTML code for your "Buy Now" buttons, which means that a third-party can tamper with the item variables and make fraudulent payments if they so choose.
If you are using an Advanced button on your website or have integrated AlertPay with your shopping cart application, we highly recommended that you use our Instant Payment Notification (IPN) feature to verify the payments made to your account.
An IPN is a notification that contains details on the payment and the customer. You can use this information for any post-payment tasks, such as updating your inventory or database, issuing receipts and fulfilling orders.
AlertPay notifies you as soon as a transaction has been successfully made and posts all the payment details at a URL (in your website) that you have provided. IPN messages are sent when payments are made on your website through our checkout page or when you have successfully paid someone through AlertPay’s MassPay API.
To learn more about using our Instant Payment Notification, please refer to our IPN Guide.

AlertPay-Instant Payment Notification Guide

Overview

IPN stands for Instant Payment Notification. It is a notification message that contains all the payment details data as well as your customer’s information. You would use the given information for any post-payment operations, such as updating your inventory or database, issuing a receipt and fulfilling orders.

What is IPN?

AlertPay notifies you as soon as a transaction has been made successfully and posts all the payment details on your website at a URL that you must provide. IPN messages are sent when payments are made on your website through our checkout page or when you have successfully paid someone through AlertPay’s MassPay API.
To capture and process the data contained in the IPN, you will have a script written in the web programming language(s) of your choice which will wait for and handle any incoming messages. The program or script is often called the IPN Handler or Listener and it should be located at the Alert URL you have provided in your AlertPay account. The Alert URL is a specific URL where your IPN messages will be sent.
Depending on the needs of your website, your IPN Handler may perform different actions with the IPN messages. Here are few examples:
  • Update an inventory
  • Update and fulfill a customer’s order
  • Automatically make a payout upon receipt of a payment using our SendMoney API
AlertPay also notifies you by email when a payment is made to your account. Our IPN messages allow you to simply automate the processing of the information you receive.

Alert URL

The Alert URL is where your IPN Handler is located and where AlertPay posts the IPN messages for a particular business profile in your account. For security reasons, we take specific measures to ensure that your Alert URL remains confidential. Your Alert URL should not be included in the HTML form created for your payment buttons. It is not necessary to submit the Alert URL since AlertPay has it listed in your account profile.
Please note that the Alert URL cannot be the same as the Return URL.
To set up your Alert URL, just follow these steps:
  1. Login to your AlertPay account.
  2. Click on "Business Tools".
  3. Under "Instant Payment Notification - IPN", click on "IPN Setup".
  4. Enter your Transaction PIN and click on "Access".
  5. Click on the "Edit" icon for the respective business profile. **This is for Business accounts only. Ignore this step if you only have one business profile on your account**
  6. Enter the information:
    1. For IPN Status, select "Enabled".
    2. For Alert URL, enter the URL of the location of your IPN Handler.
  7. Click on "Update" button.

How IPN works?

AlertPay will send an IPN message back to your IPN Handler for a payment made through our checkout page or for a MassPay transaction made through our API.

IPN messages for Payment Buttons

When a customer clicks on a payment button, such as a "Buy Now" or "Subscribe Now" button, they are sent to AlertPay’s checkout page to complete their payment. Upon a successful payment, an IPN will be sent to your IPN Handler for any post-purchase processing such as updating an inventory, upgrading a membership, fulfilling an order and more.
The following diagram shows AlertPay’s response to a successful payment made through our checkout page:
AlertPay IPN Flow
  1. The customer shops on your website.
  2. When the customer is ready to pay, they click on a "Buy Now" button and are taken to AlertPay's checkout page to complete the payment.
  3. AlertPay sends the payment confirmation data to the URL of the location of your IPN Handler which will process the variables. The data consists of information about the completed purchase and the details about the buyer. You can take this captured information for post-purchase processing and authenticate the purchase by checking the following:
    • The IPN Security Code you receive matches the one generated in your AlertPay account — so you know that AlertPay sent the data.
    • The amount paid was the expected amount.
    • The amount paid was for the correct item.
    • The currency is correct.
    • ...
When AlertPay sends IPN messages it will make sure that your web server receives it. If AlertPay does not receive an acknowledgement that your server received our IPN post, then it will try again up to 9 times until your web server successfully receives the post. The attempts will occur as follows:
  • The first 3 attempts will occur every 15 minutes
  • If the previous attempts fail, the next 3 will occur every hour
  • Lastly, 3 final attempts will be made every 8 hours
The intervals between the attempts will give you enough time to correct anything on your server that is preventing you from receiving the IPN posts.
If all of the 9 attempts fail, then the IPN notification will be lost for that transaction. You may contact AlertPay’s Integration/Technical Support Team to manually re-send a lost IPN.

IPN Security Code

Your IPN Security Code provides a way of authenticating that AlertPay sent the data. You generate your IPN Security Code from your AlertPay account so only you know its value. Your IPN Security Code will not change unless you re-generate a new one. You can make this change at any time, by going to IPN Setup.
This IPN Security Code will be sent by AlertPay with all IPN posts to your Alert URL. You may then compare the code sent with the one that you have generated from your account to ensure that the information captured was sent by AlertPay.
To setup your IPN Security Code:
  1. Login to your AlertPay account.
  2. Click on "Business Tools".
  3. Under "Instant Payment Notification - IPN", click on "IPN Setup".
  4. Enter your Transaction PIN and click on "Access".
  5. Click on the "Edit" icon for the respective business profile. **This is for Business accounts only. Ignore this step if you only have one business profile on your account**
  6. Enter the information:
    1. For IPN Status, select "Enabled".
    2. Generate a security code if necessary and record it.
  7. Click on "Update".

Sample IPN message

AlertPay’s IPN message will contain variables on a transaction, containing information about you, the buyer and related transaction details. The following is a sample IPN message that is sent to your IPN Handler for a purchase of $42.40 USD for an "item-goods".
ap_merchant%3Downer%40example.com%26ap_securitycode%3DHdhiox4S5cdOhh5p%26ap_custfirstname%3DJohn%26ap_custlastname%3DSmith%26ap_custaddress%3D5200+De+La+Savane%26ap_custcity%3DMontreal%26ap_custstate%3DQC%26ap_custcountry%3DCAN%26ap_custzip%3DH0H0H0%26ap_custemailaddress%3Djohnsmith%40example.com%26apc_1%3Dred%26apc_2%3D%26apc_3%3D%26apc_4%3D%26apc_5%3D%26apc_6%3D%26ap_test%3D0%26ap_purchasetype%3Ditem-goods%26ap_referencenumber%3D13AD5-2WD40-5UE7B%26ap_amount%3D40.00%26ap_quantity%3D1%26ap_currency%3DUSD%26ap_description%3DLorem+Ipsum%26ap_itemcode%3DSU1%26ap_itemname%3DShoes%26ap_shippingcharges%3D2.40%26ap_additionalcharges%3D0.00%26ap_taxamount%3D0.00%26ap_discountamount%3D0.00%26ap_totalamount%3D42.40%26ap_feeamount%3D1.25%26ap_netamount%3D41.15%26ap_status%3DSuccess
You will notice that our IPN message is URL-encoded. After receiving the IPN, you must URL-decode it before using its values. Further details on URL-decoding are given in the following section. After a URL-decode, the IPN message will look like the following:
ap_merchant=owner@example.com&ap_securitycode=Hdhiox4S5cdOhh5p&ap_custfirstname=John&ap_custlastname=Smith&ap_custaddress=5200 De La Savane&ap_custcity=Montreal&=QC&ap_custcountry=CAN&ap_custzip=H0H0H0&ap_custemailaddress=johnsmith@example.com&apc_1=red&apc_2=&apc_3=&apc_4=&apc_5=&apc_6=&ap_test=0&ap_purchasetype=item-goods&ap_referencenumber=13AD5-2WD40-5UE7B&ap_amount=40.00&ap_quantity=1&ap_currency=USD&ap_description=Lorem Ipsum&ap_itemcode=SU1&ap_itemname=Shoes&ap_shippingcharges=2.40&ap_additionalcharges=0.00&ap_taxamount=0.00&ap_discountamount=0.00&ap_totalamount=42.40&ap_feeamount=1.25&ap_netamount=41.15&ap_status=Success
Before using the information in the IPN, you must first verify that the message was for your account and that it was sent by AlertPay. You must make the proper validation for ap_merchant & ap_securitycode. You will need to check that ap_merchant matches the email that you have in your business profile and that the ap_securitycode matches the one that was generated in your AlertPay account. You may validate other variables depending on the needs of your business. Further details on the common variables to check are discussed in section Implementing an IPN Handler.

URL-Decode

In order to transmit special characters, characters that are not allowed in a URL and characters that have special meaning in a URL properly across the internet, URL-encoding is performed prior to sending any data. AlertPay’s IPN messages are URL-encodes all of its messages, therefore you must make sure that you URL-decode our IPN within your handler script before using the data for any processes.
For example, the following URL-encoded string, ap_custfirstname%3DJohn%26ap_custlastname%3DSmith%26ap_custaddress%3D5200+De+La+Savane, will display the following after a URL-decoded string: ap_custfirstname=John&ap_custlastname=Smith&ap_custaddress=5200 De La Savane
Here are the methods to perform URL-decoding for various web programming languages:

URL-Decoding Methods

Language URL-Decode Method
ASP.NET System.Web.HttpUtility.UrlDecode(buffer, Encoding.Default)
Classic ASP No built-in function.
ColdFusion URLDecodeurlEncodedString[, charset])
Java java.net.URLDecoder.decode
JavaScript unescape(String)
Perl uri_unescape
PHP urldecode(string)

Implementing an IPN Handler

An IPN Handler can be written in any web programming or scripting languages you like. AlertPay provides you with sample IPN Handler codes in different programming languages which will help you get started. Your IPN Handler script must be hosted by your web server.
Creating an IPN Handler for AlertPay’s IPN is simple and easy to implement. Make sure that your handler script does the following:
  1. It must be ready to capture the HTTP POST from AlertPay. All IPN messages are sent by HTTP POST.
  2. It must URL-decode the received POST variables before using them in any processes.
  3. It must verify that the IPN received was sent from AlertPay by checking the values of the following variable:
    1. ap_merchant must match with the email associated with the appropriate business profile.
    2. ap_securitycode must match with the one generated in your AlertPay account for the appropriate business profile.
Optionally, you may want to check the following variables:
  1. ap_purchasetype: Check whether the purchase type was for an item or a subscription.
  2. ap_status: Depending on the purchase type, check for the proper status. Please to the IPN Variables Reference for the complete listing of possible statuses.
  3. ap_test: Check whether the received IPN was for a test transaction
  4. ap_referencenumber: If the IPN was for a test transaction, the value of this variable will be "TEST TRANSACTION" else it will be a reference number for you to store.
  5. ap_itemname: Check if it the payment was for the correct item by matching this name with the name in your inventory.
  6. ap_currency: Check if the payment was made with the proper currency.
  7. ap_totalamount: Check if the amount paid to you was the expected amount.

Sample IPN handler in PHP

You may use the IPN Handler located at out SDKs & Sample Code section as a blueprint for your own custom-made handler. The script handles the basic validations that should be made for any received IPN. You will need to add extra lines of code in order for it to behave as your web application requires.

Testing the IPN Handler

AlertPay provides a feature that allows you to test whether your IPN Handler is able to receive and process our IPNs properly. No real funds are transferred and no Reference Number is created during this testing phase, but you will receive an IPN message with all the information pertaining to the test transaction.
To receive test IPNs, you must enable Test Mode from within your AlertPay account by following these instructions:
  1. Login to your AlertPay account.
  2. Click on "Business Tools".
  3. Under "Instant Payment Notification - IPN", click on "IPN Setup".
  4. Enter your Transaction PIN and click on "Access".
  5. Click on the "Edit" icon for the respective business account.
  6. For Test Mode, select "Enabled".
  7. Click on "Update".
After you have enabled Test Mode for your respective business profiles, you may go to your own website and make a payment to yourself by clicking on your payment buttons. This will take you to the AlertPay checkout page where you will see the details of the purchase. At the top of the page, you will see "Test Transaction" in red. This means that no transaction will be created since Test Mode is enabled.
You may login to your AlertPay account to continue the payment process. *When in Test Mode, you can pay yourself even if you do not have funds in your account.*
Once you are logged in, click on the "Pay" button to complete the payment. This does not create the transaction, but mimics the process and sends a confirmation email and IPN.
You may repeat this process as many times as you like until you are satisfied with the test results. Once you have finished testing and want to accept real payments, please turn off Test Mode in your AlertPay account.

Setting up IPN on your Account

To receive IPN messages, you are required to enable the IPN Status for a particular business profile in your account and to specify an Alert URL which is the location of your IPN Handler.
Please follow the instructions below to enable your IPN Status and to set up your Alert URL:
  1. Login to your AlertPay account.
  2. Click on "Business Tools".
  3. Under "Instant Payment Notification – IPN", click on "IPN Set up".
  4. Enter your Transaction PIN and click on "Access".
  5. Click on the "Edit" icon for the respective business profile. **This is for Business accounts only. Ignore this step if you only have one business profile on your account**
  6. Enter the information:
    1. For IPN Status, select "Enabled".
    2. For Alert URL, enter the URL of the location of your IPN Handler.
    3. Generate a security code if necessary and record it.
    4. For Test Mode, choose to enable or disable it for this business profile. (See "Test Mode" section for more information)
  7. Click on "Update".

IPN Troubleshooting

The most common issue with IPNs is not being able to receive them. Here are the possible reasons why your IPN Handler is not receiving any of our IPNs.
  1. Your Alert URL is incorrect and does not link to your script. Make sure that you have entered the proper URL of the location of your script.
  2. Your Return URL is the same as your Alert URL. Our system does not allow these two URLs to be exactly the same. You must specify a unique URL for each one of them.
  3. Your web server or host provider might be blocking incoming messages from our public IP. AlertPay sends its IPNs from one of the following servers: 174.142.185.131 or 174.142.185.132. (The following IPs are no longer in effect 67.205.87.225, 67.205.87.226 or 67.205.87.235)
  4. The firewall settings on your web server that might be blocking HTTP POST from AlertPay.

AlertPay -Standard Integration Guide

Introduction
Standard Integration does not require a seller to have any web programming knowledge to get started — a simple understanding of HTML and web page creation is sufficient to make use of the Standard Integration button. All the items and subscription buttons created with this method are stored in your AlertPay account; you can view the code or edit the item/subscription directly from your own account.
Standard Button Creation
To create a Standard Integration button, use the Button Creation Tool in your AlertPay account. This tool will generate the HTML code for your button which you can place on your web page.
If you would like to create a Standard Integration button, please follow these instructions:
  1. Login to your AlertPay account.
  2. Click on "Business Tools".
  3. Under "Standard Integration", click on either "Manage Items" or "Manage Subscriptions".
  4. Click on "Add".
  5. Enter all required information.
  6. Click on "Finish".
  7. Copy and paste the generated code into your website.
All items/subscriptions created using the Button Creation Tool will be automatically stored in your AlertPay account.
Anatomy of an Standard Button Code
The HTML code for a Standard Button will only contain two parameters which are the following: ap_productid and ap_quantity. Here is a sample Standard "Buy Now" button:
<form method="post" action="https://www.alertpay.com/PayProcess.aspx">
    <input type="hidden" name="ap_productid" value="DxVnKkNK4eOgcBSeiJfiyA=="/>
    <input type="hidden" name="ap_quantity" value="1"/>

    <input type="image" src="https://www.alertpay.com/Images/BuyNow/pay_now_11.gif"/>
</form>
   
The sample code above transmits the parameters (shown in boldface) and their value to our checkout page using the POST method: https://www.alertpay.com/PayProcess.aspx.
The most important parameter is the ap_productid since it displays the details about the item/subscription/service on our checkout page. If there are any mistakes or typos in the product ID string, an error message will be displayed rather than a regular checkout page.
Managing Items or Subscriptions
Each button created with the Button Creation Tool will have a unique product ID and will be associated with an item or a subscription that is stored in your account. Since all the details for a product is stored in your AlertPay account, whenever you make any changes to its payment details, the changes made will automatically be reflected in the buttons that you previously put on a website. You do not have to upload the HTML code to your website again.
Editing an item will not change its product ID; therefore, AlertPay will always use the correct information for the proper item when the buyer reaches our checkout page.
If you would like to modify, delete or view the HTML code for one of your stored items, please follow these instructions:
  1. Login to your AlertPay account.
  2. Click on "Business Tools".
  3. Under "Standard Integration", click on either "Manage Items" or "Manage Subscriptions".
  4. Click on "Edit", "Code" or "Remove" for the respective product.
Using Form Pre-Filling
Since you can accept payments from people who do not have an AlertPay account, you can easily send information related to a buyer to the form on our checkout page. If you have already captured the necessary information before the customer clicks on the payment button, such as their name and address, you can pre-fill the fields on the checkout page by adding the following optional parameters to your Standard or Advanced buttons:
ap_fname
ap_lname
ap_contactemail
ap_contactphone
ap_addressline1
ap_addressline2
ap_city
ap_stateprovince
ap_zippostalcode
ap_country
You must generate the values for each field listed above from the captured information after the customer clicks on a payment button.
Here is an example of a Standard "Buy Now" button’s HTML code with optional form pre-filling parameters:
<form method="post" action="https://www.alertpay.com/PayProcess.aspx" >
    <input type="hidden" name="ap_productid" value="DxVnKkNK4eOgcBSeiJfiyA=="/>
    <input type="hidden" name="ap_quantity" value="1"/>
   
<input type="hidden" name="ap_fname" value="John" />
        <input type="hidden" name="ap_lname" value="Doe" />
        <input type="hidden" name="ap_contactemail" value="email@domain.com" />
        <input type="hidden" name="ap_contactphone" value="5555555555" />
        <input type="hidden" name="ap_addressline1" value="123 Test Street" />
        <input type="hidden" name="ap_addressline2" value="Apt #101" />
        <input type="hidden" name="ap_city" value="Montreal" />
        <input type="hidden" name="ap_stateprovince" value="QC" />
        <input type="hidden" name="ap_zippostalcode" value="H0H0H0" />
        <input type="hidden" name="ap_country" value="CAN" />   
       

    <input type="image" src="https://www.alertpay.com/Images/BuyNow/pay_now_11.gif"/>
</form>
   
   
The previous code will generate the following on our checkout page:
Please refer to the Form Pre-Fill parameters table for a complete description of each variable.
Multi-Item Button
The Multi-Item functionality is only available for Advanced Integration buttons. Please refer to the Advanced Integration and Multi-Item Button guides for more information. Further note that Advanced Integration is recommended for experienced developers and integrators only.
Standard Button Security & IPN
Since the payment details for a product is stored in your AlertPay account, your payment button has less risk of being compromised or tampered with by a malicious third-party — unless they have direct access to your AlertPay account. The HTML code for your button is therefore "safe" since the only value that is exposed is the product ID which must match exactly what is stored on your account. Invalid product ID will simply result in an error message being displayed on our checkout page.
Contrary to the Advanced Button which requires the implementation of an IPN handler, the Standard Button is not required to do the same. However, AlertPay will always send an email notification and an Instant Payment Notification (IPN) for payments made to you through your buttons. To learn more about using our Instant Payment Notification, please refer to our IPN Guide.

Popular Posts