cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically specify transaction amount and rebilling schedule when using hosted iframe

Hello,

 

I love all the options that the authorize.net CIM has to offer, and I really love the iframe. However, I admit I'm a little bit stumped as to how to send the initial transaction amount to authorize.net when using the hosted iframe. I understand that customers can be billed from the authorize.net site, but this is not an ideal solution. We chose CIM because of it's flexibility and automation capabilities.

 

The way I have this set up so far is that...

 

Customer fills out a registration form.

Script uses the email address from that registration form to request a customerProfileId from authorize.net.

When authorize.net successfully returns a customerprofileId, the script requests a token in order to open up the hosted iframe.

Customer enters payment information.

 

Where in this process do I set the transaction amount and rebilling amount (which is different) and schedule?

 

 

Thank you in advance for any insight you can offer.

 

Fundamental
Contributor
1 ACCEPTED SOLUTION

Accepted Solutions

The iframe do not create transaction, it just a way to get CC info without going thru your web site.

Once the customer create at least one payment profile, they would return to your site, buy something and pick one payment profile to pay for whatever, and at the backend you would call the CreateCustomerProfileTransaction with the customer profile id and that payment profile id and the amount.

As for scheduling, you would have a schedule(cron) job that would run the create rebilling(CreateCustomerProfileTransaction).

View solution in original post

RaynorC1emen7
Expert
7 REPLIES 7

The iframe do not create transaction, it just a way to get CC info without going thru your web site.

Once the customer create at least one payment profile, they would return to your site, buy something and pick one payment profile to pay for whatever, and at the backend you would call the CreateCustomerProfileTransaction with the customer profile id and that payment profile id and the amount.

As for scheduling, you would have a schedule(cron) job that would run the create rebilling(CreateCustomerProfileTransaction).

RaynorC1emen7
Expert

Oh... here I was envisioning passing some additional parameters to the create customer payment profile request...

 

So, theoretically, once I put a close popup button (submit) on the iframe, that click event could trigger charging the membership fee, then upon receiving a successful response I could then update the database, and schedule a chronjob to reill a certain amount on a monthly schedule, and trigger certain events to happen upon response of success or error... (update database, notify customer of failed billing attempt, etc)...

 

 

once I put a close popup button (submit) on the iframe

the iframe in running on authorize.net so, you won't be able to add a close popup button. But you can pass in addtional param hostedProfileReturnUrl and  hostedProfileReturnUrlText that the custom can use to return to your site after they finish add/update/delete their payment profile.

 

other then that, the others step sound like it should work.

 

I'd forgotten about those parameters until you mentioned it, and just tried it out, but the problem with those parameters is that the customer remains inside the iframe. I really liked the button it provided, though, and wish I could do something with the coding in that section to take a user out of the iframe and totally replace the url....

 

I also tried editing the popup.js script as suggested in the example code:

 

AuthorizeNetPopup.options.onPopupClosed = function()

{

  // your code here

    window.parent.location("link to login screen here");

}

 

(I also tried using "window.parent.replace("link to login");" and "window.parent.refresh" and variants, but I may be putting the script in the wrong place because it doesn't seem to be doing anything)

 

I found a post which might be userful, however - http://community.developer.authorize.net/t5/Integration-and-Testing/Almost-got-it-one-final-hump-to-...

 

... so I'll give those ideas a try as well.

I don't seem to be getting this function in the correct place. I can't have the cdata header in the top of my file, because I'm parsing the file for a button to trigger a click event for another button and the ]]> at the end of cdata is throwing errors, so I have to edit the popup.js script itself.

I did try having a cdata section on top of the popup.js file itself, but that doesn't sem to be correct syntax, as the option I chose are not performing correctly. It's easy enough to edit the popup.js file itself to change certain parameters, such as test environment, accept echecks, skip z-index, etc, but where do I put the AuthorizeNetPopup.options.onPopupClosed = function() {}; section?

 

Seems like it ought to go right after this line:

if(AuthorizeNetPopup.options.onPopupClosed) AuthorizeNetPopup.options.onPopupClosed(); but then I don't see how the logic flow makes sense.

 

Then again I've been working a LOT of overtime to make this whole registration with payment system functional by tonight so I may be looking at things the hard way.

Did you try just like what WHeisenberg did and

and replace the section is popup.js

// Uncomment these lines to define a function that will be called when the popup is closed.
// For example, you may want to refresh your page and/or call the GetCustomerProfile API method from your server.
//AuthorizeNetPopup.options.onPopupClosed = function() {
//	your code here.
//};

to

AuthorizeNetPopup.options.onPopupClosed = function redirect()
    {
        alert("here i am");
    }

and I'm not sure if you need to uncomment the

//<![CDATA[
//]]>

 

 

 

This is exactly what I'm looking for.

 

Can you tell me where I can find documentation on how the communication with or what commands to use for the iFrame?

 

What functionality does the iFrame contain?