The parameter payload to function getGatewayURL is required but was not passed in.

41 views
Skip to first unread message

Simon Simon

unread,
May 17, 2017, 9:35:26 PM5/17/17
to cfpayment
Hi guys, new to using cfpayment, and im getting the following error:

The parameter payload to function getGatewayURL is required but was not passed in.

/api/gateway/braintree/braintree.cfc:158


From:


<cfset config = { 
path = "braintree.braintree",
    environment = "SANDBOX",
    merchantId = "****",
    privateKey = "***",
    publicKey = "***"
}>


<cfset cfpayment = createObject("component", "cfpayment.api.core").init(config) />

<cfset gateway = cfpayment.getGateway() />

<cfscript>
gateway.setTestMode(true);
</cfscript>

<cfset money = cfpayment.createMoney(5000, "NZD") />
<cfset account = cfpayment.createCreditCard() />
<cfset account.setAccount(4111111111111111) />
<cfset account.setMonth(10) />
<cfset account.setYear(10) />
<cfset account.setFirstName("John") />
<cfset account.setLastName("Doe") />

<cfset response = gateway.authorize(money = money, account = account) />
<cfset response = gateway.capture(money = money, transactionid = response.getTransactionID()) />

Brian G

unread,
May 17, 2017, 11:15:44 PM5/17/17
to cfpayment
Simon, 

Not quite sure why it's doing this to you.  Basically in .authorize() it's putting together a struct of arguments called `post` and calling:

`<cfreturn process(payload = post, options = options) />`

process() then does some preprocessing and called: 

`<cfset response = createResponse(argumentCollection = super.process(payload = p)) />`

And in base.cfc, the process() has an argument:

`<cfargument name="url" type="string" required="false" hint="URL to get/post" default="#getGatewayURL(argumentCollection = arguments)#" />`


for some reason, that getGatewayURL() call isn't passing an argument "payload", but payload is a required argument of base.process() and as far as I can see, it is present in those above calls. What's odd is I used this braintree setup for a long time so not sure why that isn't working.

You should be able to get it to work though by updating:

`<cfset response = createResponse(argumentCollection = super.process(payload = p)) />`

to be

`<cfset response = createResponse(argumentCollection = super.process(url = getGatewayURL(payload = p), payload = p)) />`


Before you go too far - this is for the old Orange platform, not the newer Blue platform, so make sure you're on the right thing before you spend time with this braintree implementation. There is a CFC-wrapper for the newer platform's Java library. I doubt you are on the old Orange platform.


Brian

Simon Simon

unread,
May 17, 2017, 11:24:54 PM5/17/17
to cfpayment
Hi Brian,

Thanks for the fast reply, updated as per your suggestion in braintree.cfc, however i now have a diff error:

The parameter authorization to function capture is required but was not passed in.

Which is reporting as called from (second line below):

<cfset response = gateway.authorize(money = money, account = account) />
<cfset response = gateway.capture(money = money, transactionid = response.getTransactionID()) />

Brian G

unread,
May 17, 2017, 11:47:47 PM5/17/17
to cfpayment
Check the method signature - it wants transactionid to be passed as "authorization". So just change the argument name in the .capture() call.

Simon Simon

unread,
May 17, 2017, 11:55:54 PM5/17/17
to cfpayment
Awesome! Thanks you so much!

I got this back:

response=1&responsetext=SUCCESS&authcode=123456&transactionid=3623587775&avsresponse=&cvvresponse=&orderid=&type=capture&response_code=100&customer_vault_id=&address_1=&city=&postal_code=&state=

Does this mean I have processed a payment? (sandbox) - I cant see a payment in braintree transactions...

Simon

On Thursday, 18 May 2017 13:35:26 UTC+12, Simon Simon wrote:
Reply all
Reply to author
Forward
0 new messages