Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Ecommerce need help add more payment gateway


Go to End


10 Posts   4332 Views

Avatar
snovvvolf

Community Member, 51 Posts

27 June 2008 at 4:47am

i know that when need to add more then one payment gateway must add in the code, can some one show me how to add in the code.

For example:

class CustomPayment extends Payment {

// insert your payment code here, refer to DPSPayment.php or WorldpayPayment.php
// for reference.

}

what code to write in the //???,what is the payment code, where can i find it?

Avatar
Willr

Forum Moderator, 5523 Posts

27 June 2008 at 9:31am

refer to DPSPayment.php or WorldpayPayment.php..

The code you write in there is whatever custom code you need to connect/sync with the payment system. You need to at least overload these methods with your custom payment code

	function getPaymentFormFields() {
           // your payment gateway fields
	}
	
	function processPayment($data, $form) {
          // how to process your payment - send to server etc
	}
	
	function getPaymentFormRequirements() {
          // required fields
	}

Avatar
snovvvolf

Community Member, 51 Posts

27 June 2008 at 3:30pm

HI willr

i still every ble ble, what is the code you show me, no too detail.

can write down the code like wordpay and paypal payment gateway i want to add in my ecommerce.

give me the guide can follow step by step.

thank

Avatar
Willr

Forum Moderator, 5523 Posts

27 June 2008 at 3:59pm

can write down the code like wordpay and paypal payment gateway i want to add in my ecommerce.

The code for those 2 gateways are bundled with the Ecommerce module I suggest you dig round inside those and play around with how they work. The most simiplest (well the easiest to follow is the DPSPayment.php

give me the guide can follow step by step.
There is no written guide on how to setup a custom payment, Ive never written one but if you use DPSPayment.php as a good start then your CustomPayment.php file would look like http://pastie.org/223108

Again, best bit is to dig round WorldPayPayment.php, DPSPayment.php and PaypalPayment.php for examples

Avatar
snovvvolf

Community Member, 51 Posts

28 June 2008 at 8:50pm

willr

can i just copy and paste the code from the pastie.org site, do i need to edit any think on the code?

Avatar
Willr

Forum Moderator, 5523 Posts

28 June 2008 at 8:57pm

do i need to edit any think on the code?

You need to edit it to support your payment gateway. What payment gateway are you trying to support?

Avatar
snovvvolf

Community Member, 51 Posts

28 June 2008 at 9:10pm

i try to use paypal payment gateway. what shut i edit?, i already download a new paypal.php on the forum, can i upload to my ecommerce file to add in the new paypal.php. and one more fill is paypal payment gateway file.ss where i must upload this .ss file to wich folder?

the paypal payment.ss file code is like below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
<% base_tag %>
<title>$Title</title>
<link href="$project/css/typography.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#paypalPaymentPage {
margin: 200px;
}
</style>
</head>
<body id="paypalPaymentPage">
<div class="typography">
$PayPalInstructions
$Content
</div>
</body>
</html>

Avatar
Willr

Forum Moderator, 5523 Posts

28 June 2008 at 9:16pm

I believe that code should go in themes/yourtheme/Templates/

Go to Top