• Francia
Buscar
Categoria
Tags
Argentina
Argentina
Implementación
Formulario incrustado (tarjetas)
API REST
API REST PCI-DSS
Formulario en redirección
Intercambio de ficheros
Pago móvil
Ejemplo de código
Módulos de pago
Back office
Ayuda
FAQ
Contacto

Inicio rápido

Esta página describe una integración rápida en 3 pasos con un ejemplo práctico.

Consulte este enlace para obtener una guía completa: Integración de formularios de pago.

I. Crear el formToken

  1. Cree una solicitud de pago hacia el Web ServiceCharge/CreatePayment.
  • Esta contiene el contexto del pago (monto, divisa, número de pedido, datos del comprador, etc.).

  • Ejemplo de pago simple:

    • cantidad: 99,00 $.
    • comando: "myOrderId-999999",
    • correo electrónico del comprador: "sample@example.com".

Para enviar la solicitud, autentifícate con las claves de la API REST (para más información:Paso 2: Autenticarse )

/doc/es-AR/rest/V4.0/api/kb/authentication.html
https://github.com/lyra/rest-php-examples/blob/master/www/minimalEmbeddedForm.php#L9-L44
https://api.cobroinmediato.tech/api-payment/V4/Charge/CreatePayment
{
    "amount":   9900,
    "currency": "ARS",
    "orderId":  "myOrderId-999999",
    "customer": {
        "email": "sample@example.com"
    }
}
{
    "amount":   1500,
    "currency": "PEN",
    "orderId":  "myOrderId-999999",
    "more": "parameters",
    "customer": {
        "email": "sample@example.com"
    }
}
{
    "amount":   20000,
    "currency": "ARS",
    "orderId":  "myOrderId-999999",
    "more": "parameters",
    "customer": {
        "email": "sample@example.com"
    }
}
{
    "amount":   100000,
    "currency": "COP",
    "orderId":  "myOrderId-999999",
    "more": "parameters",
    "customer": {
        "email": "sample@example.com"
    }
}
{
    "amount":   2500,
    "currency": "BRL",
    "orderId":  "myOrderId-999999",
    "more": "parameters",
    "customer": {
        "email": "sample@example.com"
    }
}

La respuesta será:

{
    "status": "SUCCESS",
    "_type": "V4/WebService/Response",
    "webService": "Charge/CreatePayment",
    "applicationProvider": "COIN",
    "version": "V4",
    "applicationVersion": "4.1.0",
    "answer": {
        "formToken": "DEMO-TOKEN-TO-BE-REPLACED",
        "_type": "V4/Charge/PaymentForm"
    }
}
  1. Recupere el formToken generado para mostrar el formulario de pago.

El formToken generado es Processing...

II. Mostrar el formulario

Una vez generado el formToken, muestre el formulario de pago.

  1. En elHEAD,
  • cargar nuestra biblioteca JavaScript : src='https://static.cobroinmediato.tech/static/js/krypton-client/V4.0/stable/kr-payment-form.min.js'

  • intégrez obligatoirement la clé publique dans le paramètre kr-public-key (3 ème clé du tableau des clés API REST ).

  • intégrez d'autres paramètres d'initialisation, comme le paramètre kr-post-url-success en cas de paiement accepté (Etape 4 : Afficher le formulaire de paiement)

    • Ejemplo: kr-post-url-success ='[SUCESS PAYMENT URL]'
  • elija un tema (más información en Temas ).

  1. En elBODY,
  • elija modo de visualización :

    • con elclass= kr-embeddedpara elmodo incrustado(Modo incrustado)
    • con elclass= kr-embeddedy atributokr-popinpara elmodo pop-in (Modo pop-in)
  • valor , el formToken , en el atributo. kr-form-token

Modo incrustado

Ejemplo de código para la tienda TEST

<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />

<!-- STEP :
1 : load the JS librairy
2 : required public key and the JS parameters as url sucess -->

<script type="text/javascript"
        src="https://static.cobroinmediato.tech/static/js/krypton-client/V4.0/stable/kr-payment-form.min.js"
        kr-public-key="45789921:testpublickey_qSbs1nvRJEdy74KqANWo6TnGnRsTzwFMd9DYrO9OCdiHD"
        kr-post-url-success="[SUCESS PAYMENT URL]";>
 </script>

 <!-- 3 : theme néon should be loaded in the HEAD section   -->
<link rel="stylesheet" href="https://static.cobroinmediato.tech/static/js/krypton-client/V4.0/ext/neon-reset.min.css">
<script type="text/javascript" src="https://static.cobroinmediato.tech/static/js/krypton-client/V4.0/ext/neon.js">
    </script>
</head>

<body>

<!-- 4 : display the form payment -->
<div class="kr-embedded" kr-form-token="[GENERATED FORMTOKEN]">

</div>
</body>
</html>

Ejemplo de formulario de pago funcional:

El formulario está operativo, puede realizar un pago con las tarjetas de prueba de la barra de depuración (esquina inferior izquierda de esta ventana).

El cliente JavaScript utiliza elementos DIV especiales para insertar los campos del formulario.

kr-first-installment-delay Número de meses de diferido que se aplicarán a la primera cuota
kr-installment-number Número de cuotas
kr-identity-document-type Tipo de documento de identidad
kr-identity-document-number Número del documento de identidad
kr-card-holder-name Nombre del titular de la tarjeta
kr-card-holder-mail Dirección e-mail del titular de la tarjeta

Clases que se utilizan para personalizar los campos. Consulte :Parámetros generales

III. Analizar el resultado del pago

Al finalizar el pago, puede analizar el resultado del mismo desde:

  • la notificación de pago instantánea: IPN: Uso de la IPN (URL de notificación).
  • La respuesta enviada al navegador: Análisis del resultado del pago a través del retorno del navegador.

Un mecanismo de seguridad verifica la autenticidad de la información enviada, con el kr-hash.

En el objeto ,PAYMENT, un ejemplo de un kr-answer, :

{
  "shopId": "45789921",
  "orderCycle": "CLOSED",
  "orderStatus": "PAID",
  "serverDate": "2022-01-21T09:28:17+00:00",
  "orderDetails": {
    "orderTotalAmount": 9900,
    "orderEffectiveAmount": 9900,
    "orderCurrency": "ARS",
    "mode": "TEST",
    "orderId": "myOrderId-475882",
    "metadata": null,
    "_type": "V4/OrderDetails"
  },
  "customer": {
    "billingDetails": {
      "address": null,
      "category": null,
      "cellPhoneNumber": null,
      "city": null,
      "country": null,
      "district": null,
      "firstName": null,
      "identityCode": null,
      "language": "FR",
      "lastName": null,
      "phoneNumber": null,
      "state": null,
      "streetNumber": null,
      "title": null,
      "zipCode": null,
      "legalName": null,
      "_type": "V4/Customer/BillingDetails"
    },
    "email": "sample@example.com",
    "reference": null,
    "shippingDetails": {
      "address": null,
      "address2": null,
      "category": null,
      "city": null,
      "country": null,
      "deliveryCompanyName": null,
      "district": null,
      "firstName": null,
      "identityCode": null,
      "lastName": null,
      "legalName": null,
      "phoneNumber": null,
      "shippingMethod": null,
      "shippingSpeed": null,
      "state": null,
      "streetNumber": null,
      "zipCode": null,
      "_type": "V4/Customer/ShippingDetails"
    },
    "extraDetails": {
      "browserAccept": null,
      "fingerPrintId": null,
      "ipAddress": "185.244.73.2",
      "browserUserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36",
      "_type": "V4/Customer/ExtraDetails"
    },
    "shoppingCart": {
      "insuranceAmount": null,
      "shippingAmount": null,
      "taxAmount": null,
      "cartItemInfo": null,
      "_type": "V4/Customer/ShoppingCart"
    },
    "_type": "V4/Customer/Customer"
  },
  "transactions": [
    {
      "shopId": "45789921",
      "uuid": "1c8356b0e24442b2acc579cf1ae4d814",
      "amount": 9900,
      "currency": "ARS",
      "paymentMethodType": "CARD",
      "paymentMethodToken": null,
      "status": "PAID",
      "detailedStatus": "AUTHORISED",
      "operationType": "DEBIT",
      "effectiveStrongAuthentication": "ENABLED",
      "creationDate": "2022-01-21T09:28:16+00:00",
      "errorCode": null,
      "errorMessage": null,
      "detailedErrorCode": null,
      "detailedErrorMessage": null,
      "metadata": null,
      "transactionDetails": {
        "liabilityShift": "YES",
        "effectiveAmount": 9900,
        "effectiveCurrency": "ARS",
        "creationContext": "CHARGE",
        "cardDetails": {
          "paymentSource": "EC",
          "manualValidation": "NO",
          "expectedCaptureDate": "2022-01-27T09:38:10+00:00",
          "effectiveBrand": "VISA",
          "pan": "497011XXXXXX1003",
          "expiryMonth": 12,
          "expiryYear": 2025,
          "country": "FR",
          "issuerCode": 17807,
          "issuerName": "Banque Populaire Occitane",
          "effectiveProductCode": null,
          "legacyTransId": "929936",
          "legacyTransDate": "2022-01-21T09:28:16+00:00",
          "paymentMethodSource": "NEW",
          "authorizationResponse": {
            "amount": 9900,
            "currency": "ARS",
            "authorizationDate": "2022-01-21T09:28:16+00:00",
            "authorizationNumber": "3fe205",
            "authorizationResult": "0",
            "authorizationMode": "FULL",
            "_type": "V4/PaymentMethod/Details/Cards/CardAuthorizationResponse"
          },
          "captureResponse": {
            "refundAmount": null,
            "refundCurrency": null,
            "captureDate": null,
            "captureFileNumber": null,
            "effectiveRefundAmount": null,
            "effectiveRefundCurrency": null,
            "_type": "V4/PaymentMethod/Details/Cards/CardCaptureResponse"
          },
          "threeDSResponse": {
            "authenticationResultData": {
              "transactionCondition": null,
              "enrolled": null,
              "status": null,
              "eci": null,
              "xid": null,
              "cavvAlgorithm": null,
              "cavv": null,
              "signValid": null,
              "brand": null,
              "_type": "V4/PaymentMethod/Details/Cards/CardAuthenticationResponse"
            },
            "_type": "V4/PaymentMethod/Details/Cards/ThreeDSResponse"
          },
          "authenticationResponse": {
            "id": "30eaa40d-dd76-4617-b527-4bed6240b81c",
            "operationSessionId": "ae6f2ad3ffea41bb8faf1aefabad87b9",
            "protocol": {
              "name": "THREEDS",
              "version": "2.1.0",
              "network": "VISA",
              "challengePreference": "NO_PREFERENCE",
              "simulation": true,
              "_type": "V4/Charge/Authenticate/Protocol"
            },
            "value": {
              "authenticationType": "CHALLENGE",
              "authenticationId": {
                "authenticationIdType": "dsTransId",
                "value": "bafdb21f-e3d6-4d1c-b4f6-d1668b7f7f21",
                "_type": "V4/Charge/Authenticate/AuthenticationId"
              },
              "authenticationValue": {
                "authenticationValueType": "CAVV",
                "value": "BqLgDBHYRaCBpip3Fn3+erKT9vg=",
                "_type": "V4/Charge/Authenticate/AuthenticationValue"
              },
              "status": "SUCCESS",
              "commerceIndicator": "05",
              "extension": {
                "authenticationType": "THREEDS_V2",
                "threeDSServerTransID": "30eaa40d-dd76-4617-b527-4bed6240b81c",
                "dsTransID": "bafdb21f-e3d6-4d1c-b4f6-d1668b7f7f21",
                "acsTransID": "bd6e58b4-6f37-4993-b428-9096766d83a6",
                "_type": "V4/Charge/Authenticate/AuthenticationResultExtensionThreedsV2"
              },
              "reason": {
                "_type": "V4/Charge/Authenticate/AuthenticationResultReason"
              },
              "_type": "V4/Charge/Authenticate/AuthenticationResult"
            },
            "_type": "V4/AuthenticationResponseData"
          },
          "installmentNumber": null,
          "installmentCode": null,
          "markAuthorizationResponse": {
            "amount": null,
            "currency": null,
            "authorizationDate": null,
            "authorizationNumber": null,
            "authorizationResult": null,
            "_type": "V4/PaymentMethod/Details/Cards/MarkAuthorizationResponse"
          },
          "cardHolderName": null,
          "identityDocumentNumber": null,
          "identityDocumentType": null,
          "_type": "V4/PaymentMethod/Details/CardDetails"
        },
        "fraudManagement": {
          "_type": "V4/PaymentMethod/Details/FraudManagement"
        },
        "subscriptionDetails": {
          "subscriptionId": null,
          "_type": "V4/PaymentMethod/Details/SubscriptionDetails"
        },
        "parentTransactionUuid": null,
        "mid": "9999999",
        "sequenceNumber": 1,
        "taxAmount": null,
        "preTaxAmount": null,
        "taxRate": null,
        "externalTransactionId": null,
        "nsu": null,
        "tid": "001",
        "acquirerNetwork": "CB",
        "taxRefundAmount": null,
        "userInfo": "JS Client",
        "paymentMethodTokenPreviouslyRegistered": null,
        "occurrenceType": "UNITAIRE",
        "_type": "V4/TransactionDetails"
      },
      "_type": "V4/PaymentTransaction"
    }
  ],
  "subMerchantDetails": null,
  "_type": "V4/Payment"
}
  • Para más detalles, Paso 5: Analizar el resultado del pago.

  • También puede probar el formulario de pago utilizando el Playground interactivo.

© 2023 | Todos los derechos reservados de Cobro Inmediato
2.38.0-doc-1.9