Add a simple pay button

(Charlie Heath) #1

I’m trying to add a simple pay button to a website.

Using the simple pay button generated at , I get code and integrate it, but the link which is described as being a return after completion link seems to be used as a callback, for which I can find no example code to imitate. I get the below JSON return:

{“Result”:“Failure”,“Message”:“Application or purchase order does not have a payment callback URL associated with it. Please submit an application details change request or provide a callback URL.”}

I’ve looked at the generated application for the button and can’t see any obvious way to disable the need for a callback. Is there one?

I’d be glad to implement a REST api (php) but the examples I see are partial and seem to be a mix of V1 and V2 api that I can’t decipher. I do client-server development and have developed my own REST apis, so I could spend a few days on this and get something that seems to integrate, but I’d rather just take a well tested, approved model file, similar to Paypal’s IPN examples for payment notifications, and plug in my OATH credentials tailored so that they have exactly the permissions DWOLLA asserts are needed to do a simple pay now button integration. I need one bit of information, a transaction ID I generate, passed from the pay now button (plus amount) to my callback. Is there such a standard example for the callback, in PHP? I’d like to get this online today if possible (spend 10 hours on it yesterday).

Thanks - Charlie

(Spencer Hunter) #2

Hi @TownWebsites, If you’re looking for a simple integration for one-time payments, I’d recommend taking a look at integrating with our Off-site gateway directly. (the payment button leverages our Off-site gateway)

I’d recommend taking a look at the forum thread below which describes submitting a form to initiate a Off-site gateway checkout flow and handling the redirect from Dwolla.

As an alternative to the gateway, let me know if you are looking for an OAuth + Transfers integration and I can walk through the steps to accomplish this type of integration with our v2 API. :slight_smile:

(Charlie Heath) #3

Thanks for your reply. I started an off-site gateway implementation, have a form set up most of the way to do it. I gave up on that one at 4am last night, but can try again.

The example code from Help! PHP Developers need a “Simple” … looks like it should almost work with the simple button generator. Is there an example file anywhere that does work with the simple button generator? Is the simple button generator supported at all?

(Spencer Hunter) #4

The payment button is still supported, however we removed the button generator from To get a working payment button, you’ll want to go to and create and application. You will receive an API key and secret after creating the application. You’ll drop in the button script code on your page where you want the payment button to render (remember to include your API key in the data-key param).

  data-key="[YOUR KEY HERE]"
  data-label="A Test Button!"
  data-name="Test Product"
  data-description="I love tests!"

For handling the redirect from Dwolla, checkout the return.php file in the forum thread I previously referenced.

(Charlie Heath) #5


The return.php from the “Help! PHP” post works with the addition of the data-callback. I suggest adding a verion of this return.php to your api documentation, and adding a commented out database update that maintains status and other variables from the callback (which I’m assuming will receive ongoing payment status notifications?)

The simple button generator is still on developer.dwolla,com, and is the first google search result for simple integration. Probably should be updated to include data-callback and a sample script, or redirected.

(Charlie Heath) #6

A followup question and a comment.

I have both a data-callback and data-redirect declared in a simple button,

The data-redirect gets displayed to the browser after the transaction. My recollection is it is called with GET rather than POST, meaning the transaction info is shown in the browser url and may be cached. I suggest that should be POST for security.

The data-callback does not seem to be called at all. What I’d like is to have a callback which is called like Paypal IPN, which calls immediately and may be called again when payment status changes. Any thoughts on why the callback does not seem to get called, or how I can assure I get both the initial notice and status changes on money sent?

(Spencer Hunter) #7

True. However, without obtaining authorization to look up the transaction then there is no information in the redirect that is deemed as sensitive information.

Hmm, strange. What is the value of “postback” on the redirect? What are you setting your callback url to? Can you update your callback url to a request bin to see if the callback fires there?

You’ll want to subscribe a webhook url in your applications settings to listen for changes in the status of the transaction. More information can be found here:

You’ll be listening for two things: a.) the initial callback from the gateway checkout. This tells you if the checkout completed and if a transaction was actually created. and b.) webhooks that update you on the status of the transaction created.

(Charlie Heath) #8

Turned out I had php errors. I’ve set up better debugging tools .

A couple more questions. I have set up a webhook and I don’t want to use the php API. I see the header signature and am trying to validate that against hmac sha1 hash of the php body. I don’t see the sha256 header so assume that isn’t available from the simple button. I can’t match the header signature. Is there any complete example code for a webhook, for php but not using the API?

Also wonder about receiving the data-description, data-name, or data-note values. I don’t see them either in the data-callback script or the webhook, the only identifying info I seem to be able to pass through is OrderId. Should I be able to pass anything else descriptive to the callback or webhook?

(Carole Hayes) #9

The above link for the button generator still works… Does this mean the button generator itself won’t work, or did you just remove the link to it from the Dwolla site? WHY would you remove the button generator, anyway???

(Spencer Hunter) #10