WebSite X5Help Center

 
Noah S.
Noah S.
User

Custom Code for 3rd party payment processing  en

Autor: Noah S.
Besucht 1318, Followers 2, Geteilt 0  

I need to set up a payment option using the Heartland.  They have several plugins available but not for X5.  The custom code  they provide doesn't seem to work when dropped into the custom code section of the payment options.

Here is the code:

<formid="payment_form"method="post"action="/process">
  <!-- Your payment fields go here -->
  <dt><labelfor="iframesCardNumber">Card Number:</label></dt>
  <dd><divid="iframesCardNumber"></div></dd>

  <dt><labelfor="iframesCardExpiration">Card Expiration:</label></dt>
  <dd><divid="iframesCardExpiration"></div></dd>

  <dt><labelfor="iframesCardCvv">Card CVV:</label></dt>
  <dd><divid="iframesCardCvv"></div></dd>

  <br/>
  <divid="iframesSubmit"></div>

  <!-- Regular input fields are ok, too -->
  <inputtype="hidden"name="payment_token"/>
</form>

And the Script

<script src="https://api.heartlandportico.com/SecureSubmit.v1/token/2.1/securesubmit.js"></script>
<script type="text/javascript">
(function(window,document,Heartland){
  varhps=newHeartland.HPS({
    publicKey:'pkapi_cert_YS5lWAwgoWVLmyVToq',
    type:      'iframe',
    fields:{
      cardNumber:{
        target:      'iframesCardNumber',
        placeholder:'•••• •••• •••• ••••'
      },
      cardExpiration:{
        target:      'iframesCardExpiration',
        placeholder:'MM / YYYY'
      },
      cardCvv:{
        target:      'iframesCardCvv',
        placeholder:'CVV'
      },
      submit:{
        target:      'iframesSubmit'
      }
    },
    onTokenSuccess:function(resp){
      varform=document.getElementById('payment_form');
      varpayment_token=document.getElementById('payment_token');
      payment_token.value=resp.token_value;
      payment_form.submit();
    },
    onTokenError:function(resp){
      if(window.console&&window.console.log){
        console.log('There was an error: '+resp.error.message);
      }
    }
  });

  Heartland.Events.addHandler(document.getElementById('iframes'),'submit',function(e){
    e.preventDefault();
    hps.Messages.post(
      {
        accumulateData:true,
        action:         'tokenize',
        message:        'pkapi_cert_YS5lWAwgoWVLmyVToq'
      },
      'cardNumber'
    );
  });
}(window,document,Heartland));
</script>

How do I make this work?

Thank you

Gepostet am
2 ANTWORTEN - 2 NüTZLICH
Andre E
Andre E
Moderator

For what version? V9 or v15 demo?

Mehr lesen
Gepostet am von Andre E
Andre E
Andre E
Moderator

For v9 use an html object and add the table. (first part)

goto the sitemap of the page that has the'html object, use the properties button.

goto expert tab, there set the javascript in the body and change file format to php.

i still think this is not yet enough and you have to do more, check there FAQ for help.

Mehr lesen
Gepostet am von Andre E