payu payment gateway

0

Good morning friends, I want to implement the payment gateway with payu in my ionic app, I do not have the clear information about what I have to do I have seen in the documentation that I must send a form in json or xml format, but not I know where to place that form or what to ask the user for that purpose.

here I have the form to request the data to the user

I appreciate you can help me

    
asked by frd 19.10.2016 в 14:47
source

1 answer

2

The truth is that to answer your question exactly we need more information, we can ask ourselves where do you want to send the information ?. But as I see that your problem is also not knowing how to send the information in the format that you are asked or how to send it, I leave you a code that helps you to bring data from a form, pass them to json and send them to a URL with method POST .

<div class="list">
  <label class="item item-input">
      <input type="text" placeholder="Numero de tarjeta" ng-model="data.numero_tarjeta">
  </label>
  <label class="item item-input">
      <input type="text" placeholder="Nombre" ng-model="data.nombre">
  </label>
  <label class="item item-input">
      <input type="text" placeholder="MM" ng-model="data.mm">
  </label>
  <label class="item item-input">
      <input type="text" placeholder="AA" ng-model="data.aa">
  </label>
  <label class="item item-input">
      <input type="text" placeholder="CVV" ng-model="data.cvv">
  </label>
  <button ng-click="enviarInfo(data)" class="button button-large button-positive">
      Enviar
  </button>
</div>

This HTML code is your form (it's an example) where I define all the fields I need plus the ng-model tag, this helps you define a model to your fields that you can handle both in the view and in the controller. The model is data and data consists of data.numero_de_tarjeta , data.aa , etc etc. The button calls a function to sendInfo (data) where data is your model, from the controller:

angular.module('mySuperApp', ['ionic'])
  .controller('PopupCtrl', function($scope, $http) {
      $scope.enviarInfo = function(data) {
              var datos = {
                  numero_tarjeta: data.numero_tarjeta,
                  nombre: data.nombre,
                  mm: data.mm,
                  aa: data.aa,
                  cvv: data.cvv
              }
              $http({
                  method: 'POST',
                  url: url,
                  data: datos,
                  dataType: "json",
                  contentType: "application/json"
              }).then(function(response) {
                      //Exito en el post
                  },
                  function(response) {
                      //Error en el post
                  });
          }

  });

In the controller we define the function

$scope.enviarInfo = function(data)

We do this to receive the information, once we receive we put together an arrangement:

 var datos = {
  numero_tarjeta : data.numero_tarjeta,
  nombre : data.nombre,
  mm : data.mm,
  aa : data.aa,
  cvv : data.cvv
}

And within our function sendInfo we occupy the $http directive that helps us make a request either send or receive information to a defined URL, in this case URL = URL because only you know that value.

I leave a Codepen in which you will find exactly the same code but you can see it in a more orderly way, obviously the sending of the information is not going to work because I do not have test data where to do a post , neither I know what your intention is.

Codepen

EDIT

As we already discussed, I advise you to read, study and understand the API of your PAYU payment method, especially for your country Colombia since the payment treatment is different for each country.

Api PAYU in Spanish for Colombia

    
answered by 19.10.2016 / 18:26
source