June 22, 2018, 6:32 pm


How to create Dynamic Pay Button?

Date added:
30 November 2009
Last revised:
29 October 2012


We have created a tool for creating a Pay Button to integrate your web store with our online payment system. But the tools is only suitable for a static web store, how if you have a dynamic shopping cart (using e-commerce script)? The answer is to modify the pay button's script so it can be used to pay a dynamic amount of money of all the items in the buyer's shopping cart.

We have also created plug-ins for some public well known e-commerce / shopping cart scripts, which can be downloaded for FREE and can be used easily to integrate your dynamic shopping cart with PG-1's payment system. But if you don't find any matching plug-in, you can create it yourself by understanding how the button is created below.

Technically the PG-1's Pay Button is created using a simple HTML form. Below is the common form of the Pay Button's HTML script:

<form action="https://secure.payglobalone.com/payment.act" 
      <input type="hidden" name="merchant" value="[MerchantID]"/>
      <input type="hidden" name="store-id" value="[StoreID]"/>
      <input type="hidden" name="trans-id" value="[TransID]"/>
      <input type="hidden" name="amount" value="[Amount]"/>
      <input type="hidden" name="description" value="[Description]"/>
      <input type="image" src="[ButtonImage]" border="0"
             name="submit" alt="Pay Securely using PG-1"/>

The emphasized text above are the parameters you need to modify. Below are the descriptions for each parameter:

  • MerchantID (Alphanumeric)
    Change this parameter with your merchant primary email address. The parameter will be used to identify to which merchant the payment is made.
  • StoreID (Numeric)
    Change this parameter with your registered web store ID. You can view how to register your web store and get the Store ID by clicking this link.
  • TransID (Alphanumeric)
    Change this parameter with your web store's order ID or shopping cart ID. The id must be unique for each payment for the same store ID. Usually it's filled with the order's ID generated by the e-commerce script you are using. The ID will be send back along with other parameters when our system sends payment notifications to your e-commerce script, so the script can identify the relation between the payment and the order's record in your website and perform some actions related with the payment. Please click this link to create a handler for PG-1's payment notification.
  • Amount (Numeric)
    Change this parameter with the order's grand total, which will be paid by the buyer. The currency must be IDR, so if the transaction is saved with other currency, you must convert it first to IDR.
  • Description
    Change this parameter with the payment's description. Usually it's filled with the order's invoice number, so it can be easily tracked from PG-1's transaction history.
  • ButtonImage
    Change this parameter with the full address to the image you will be used for the button. The address must be a complete URL (including "http://"). The image will be showed and can be clicked as a payment button to PG-1's payment page.

All you need to do is creating a simple script / plug-in that can generate above HTML script and fill it with the related parameters needed. Here's the steps to find out if your Pay Button script is generated successfully:

  • You will see a button with the image you've input for the "ButtonImage" parameter.
  • If you click the button, it will shows the PG-1's Secure Payment Page with your website logo/banner.
  • At the PG-1's Secure Payment Page, you can also see the payment amount that will be paid by the buyer.

If you can see all of the above indicators, then congratulation, you have successfully integrate your dynamic web store with PG-1's online payment system.

For more information about PG-1 Merchant Account, please download PG-1 Merchant Account Manual here.


Tags for this item