Friday, November 23, 2012

Payment Get-way with ASP.NET and Payaza (Previously AlertPay)

Payment get-ways are important when you are creating a web application for selling items. Here i'm using Payaza as the payment get-way (Previously well known as Alertpay). Many people develop payment get-ways using Paypal and this is also a similar application for that.

You can download a sample application from below link.

Below image shows you hoe your application would look like when you run it.

Once the user click on the "Buy Now" user will be redirected to his/her Payaza account for authentication. Once the user authenticate the payment will be done. Below is the screen where user will be redirected

This is a very simple process below you have the code where you need to include in your .aspx page. Payaza requires parameters to be passed in the request body and the hidden fields are named as it is required by Payaza. So do not change the hidden field names and you can change any other parameter. Below are some required parameters and others are optional.

ap_merchant - Merchant email the account where money will be deposited.
ap_purchasetype - This should be "item-goods" as payaza requires.
ap_itemname - Item name
ap_amount - Item price
ap_currency - Currency
ap_quantity - Quantity required
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Payment.aspx.cs" Inherits="Default3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
    <script type="text/javascript">
        function LoadValues() {
            form1.ap_itemname.value = document.getElementById('lblItemName').innerHTML;
            form1.ap_amount.value = document.getElementById('lblAmount').innerHTML;
            form1.ap_quantity.value = form1.txtQuntity.value;
            form1.ap_itemcode.value = document.getElementById('lblItemCode').innerHTML;
            form1.ap_description.value = document.getElementById('lblDescription').innerHTML;
            form1.ap_taxamount.value = document.getElementById('lblTax').innerHTML;
            form1.ap_additionalcharges.value =document.getElementById('lblAdditional').innerHTML;
            form1.ap_shippingcharges.value = document.getElementById('lblShppping').innerHTML;
            form1.ap_discountamount.value = document.getElementById('lblDiscount').innerHTML;
    <form id="form1" runat="server">

     <input type="hidden" name="ap_merchant" value=""/>
    <input type="hidden" name="ap_purchasetype" value="item-goods"/>
    <input type="hidden" name="ap_itemname" value=""/>
    <input type="hidden" name="ap_amount" value=""/>
    <input type="hidden" name="ap_currency" value="USD"/>

    <input type="hidden" name="ap_quantity" value=""/>
    <input type="hidden" name="ap_itemcode" value=""/>
    <input type="hidden" name="ap_description" value=""/>
    <input type="hidden" name="ap_returnurl" value=""/>
    <input type="hidden" name="ap_cancelurl" value=""/>

    <input type="hidden" name="ap_taxamount" value=""/>
    <input type="hidden" name="ap_additionalcharges" value=""/>
    <input type="hidden" name="ap_shippingcharges" value=""/>

    <input type="hidden" name="ap_discountamount" value=""/>
    <input type="hidden" name="apc_1" value="Blue"/>
    <br />
            <td rowspan="11">
                <asp:Image ID="Image1" runat="server" Height="275px"
                    ImageUrl="~/switch-3-large.jpg" Width="257px" />
            <td> Item Name:</td>
            <td><asp:Label ID="lblItemName" runat="server" Text="Bag"></asp:Label></td>
            <td><asp:Label ID="lblAmount" runat="server" Text="100"></asp:Label></td>
            <td><asp:TextBox ID="txtQuntity" runat="server"></asp:TextBox></td>
            <td><asp:Label ID="lblItemCode" runat="server" Text="C001"></asp:Label></td>
            <td><asp:Label ID="lblDescription" runat="server" Text="This is a Good Item"></asp:Label>          </td>
            <td><asp:Label ID="lblTax" runat="server" Text="10"></asp:Label></td>
            <td><asp:Label ID="lblAdditional" runat="server" Text="2"></asp:Label></td>
            <td>Shipping Charges:</td>
            <td><asp:Label ID="lblShppping" runat="server" Text="10"></asp:Label></td>
            <td><asp:Label ID="lblDiscount" runat="server" Text="2"></asp:Label></td>
            <td colspan="2">
    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl=""
     PostBackUrl="" OnClientClick="LoadValues();" />
    <br />

No comments:
Write comments
Recommended Posts × +