Shopping Cart & Advance Integration with Custom Fields
The Base Commerce Hosted Payment Pages allows for custom integrations into shopping carts or other applications by utilizing a series of form post parameters. You must create a Hosted Payment page by following the Creating Hosted Payment Page and Buy Now Button guide prior to beginning the advanced integration.
The following are the parameters which can be posted to the Hosted Payment Page URL:
|Parameter Name||Description||Data Type|
|hpp_amount||The total amount of the purchase, including all items, taxes, fees, etc.||double|
|hpp_item_description_[1-99]||The description for the item.||string|
|hpp_item_price_[1-99]||The price of the item.||double|
In addition to the above parameters, you can pass any additional parameters to the hosted payment page URL and upon a successful payment, those values will be posted back to your success URL.
To pass custom fields to the Hosted Payment Page there are a few steps you will want to do to set it up.
*Note, passing custom fields to the HPP to be loaded for the user, will display in the GUI to the user, but this field is still editable by the user. If you want an un-editable field you will want to use item descriptions as mentioned above.
- First you will want to click the edit button on your Hosted Payment Page, and then go to the Custom Fields tab.
- Fill out the name of the custom fields you want to be used, you can mark them as required if you want. If you do the customer will not be able to process a transaction unless that field has a value in it.
- When loading the Hosted Payment Page URL, if you want you can pass in the custom field values to pre populate it.
- custom_field_1 to custom_field_10 are the possible values.
- When those are passed in and the customer makes the payment, those custom fields will be set on the Bank Card Transaction or Bank Account Transaction object in the corresponding custom fields on those objects.
Item Descriptions as Custom Fields
There is the ability to use the transaction descriptions passed into the URL as the custom fields set on the corresponding transactions processed. On the edit HPP dialog, custom fields tab, if you enable "Use Item Descriptions and Price For Custom Field Data" then any item descriptions passed into the URL will set as the transactions custom fields.