Credit Fund Transfer (CFT)

Credit Fund Transfer (CFT) enables merchants transfer money back into a given cardholder account. Credit Fund Transfer (CFT) is often used for e.g. payouts from a casino account and back to a given cardholder’s account or like scenarios.


Endpoints

HTTP Method API URL API Version
POST https://api.payzone.ma/transaction/credit/creditcard >= 002

Accepted parameters

Field Type Max Length Required Description Version
customerIP String 40 yes Customer request IP
amount Integer 10 yes Number in minor unit, e.g. cents; 100 dollar cent equals to 1 dollar
currency String 3 yes ISO-4217 currency codes
orderID String 100 yes Unique reference to current transaction request
Credit Card Payment fields
cardNumber String 40 yes Credit card number
cardHolderName String 80 yes
cardExpireMonth String 2 yes Month of the card expire: 09
cardExpireYear String 4 yes Year of the card expire ie: 2017
Shopper fields
shopperName String 80 yes Use ‘NA’ if unavailable
shopperAddress String 255 yes Use ‘NA’ if unavailable
shopperZipcode String 10 yes Use ‘NA’ if unavailable
shopperCity String 50 yes Use ‘NA’ if unavailable
shopperState String 30 yes ISO 3166-2 country subdivision codes if exist; 2 letters in USA, 3 letters in Australia, etc. Use ‘NA’ if unavailable
shopperCountryCode String 2 yes ISO-3166-1 country codes. Use “ZZ” if the country is unknown
shopperPhone String 20 yes Use ‘NA’ if unavailable
shopperEmail String 100 yes Use ‘NA’ if unavailable
shopperBirthDate String 8 no Use format YYYYMMDD >= 0206
shopperIDNumber String 32 no Customers document (passport number, ID number,taxpayer ID,… ) >= 0206

Code samples

Note: Gateway API transactions are done with a different library than payment-page API. See the code sample comments for more info:

   
    /*
    *   Transaction name is 'Credit', once you create a new transaction passing this as parameter, 
    *   you need to set the mandatory data using the following methods:
    *   setTransactionInformation()
    *   setCardInformation()
    *   setShopperInformation
    */

    $client = new GatewayClient();

    $transaction = $client->newTransaction('Credit', 'testMerchant', 'testPassword');
    $transaction->setTransactionInformation(2000, 'USD', 'order1456', '10.10.254.10');
    $transaction->setCardInformation('4111111111111111', null, 'John Smith', '10', '2014');
    $transaction->setShopperInformation('Jane Smith', '334 Some Drive', '90001', 'Los Angeles', 'CA', 'US', '+1 213-XXX-XXXX', 'test@mail.com');

    $response = $transaction->send();

    if ('000' === $response->errorCode) {
        $creditTransactionID  = $response->transactionID;
    } else {
        echo "Error {$response->errorCode} with message {$response->errorMessage}";
    }

                    
   
    PaymentGatewayConnector connector = new PaymentGatewayConnector(API_URL, ORIGINATOR, PASSWORD);

    CreditResponse response = null;
    CreditRequest request = new CreditRequest();
    request.setOrderId("order1456");
    request.setCustomerIP("10.10.254.10");
    request.setAmount(2000).setCurrency("USD");
    request.setShopperName("Jane Smith").setShopperAddress("334 Some Drive");
    request.setShopperZipcode("90001").setShopperCity("Los Angeles").setShopperState("CA").setShopperCountryCode("US");
    request.setShopperPhone("+1 213-XXX-XXXX");
    request.setShopperEmail("test@mail.com");

    request.setCardNumber("4111111111111111");
    request.setCardExpireMonth("10").setCardExpireYear("2014");
    request.setCardHolderName("John Smith");

    try {
        response = connector.doCreditTransaction(request);
    } catch (Exception e) {
        e.printStackTrace();
    }

    if (response != null) {
        if (TransactionResultCode.TRANSACTION_SUCCESSFULLY.equals(response.getErrorCode()) {
        System.out.println("Success: " + response.getErrorMessage());
        } else {
        System.out.println("Failure: " + response.getErrorMessage());
        }
    }

                      
   const gateway = require("payxpert")("123456", "GreatP4ssw0rd").gateway;

                    const body = {
                        customerIP: "8.8.4.4",
                        amount: 1500,
                        currency: "EUR",
                        orderID: "HELLO NODEJS",
                    
                        cardNumber: "4111111111111111",
                        cardHolderName: "CARDHOLDER NAME",
                        cardExpireMonth: "10",
                        cardExpireYear: "2024",
                    
                        shopperName: "NodeJS Test",
                        shopperAddress: "NA",
                        shopperZipcode: "NA",
                        shopperCity: "NA",
                        shopperState: "NA",
                        shopperCountryCode: "NA",
                        shopperPhone: "NA",
                        shopperEmail: "NA"
                    };
                    
                    const response = await gateway.creditFundTransfer(body);
                    
                    if (response.code == "000") {
                        // Success
                    }
                    
                    
   
    var client = new GatewayClient(OriginatorConfig.ORIGINATOR_ID, OriginatorConfig.ORIGINATOR_PASSWORD);
    var transaction = client.NewCreditFundsTransferTransaction();

    var amount = 5000;

    transaction.SetTransactionInformation(amount, "EUR", "50", customerIP);
    transaction.SetCardInformation("4111111111111111", "", "CSHARP SDK", "10", "2024");
    transaction.SetShopperInformation("CSHARP SDK", "MICROSOFT ENV", "666", "REDMOND", "WA", "US", "12445", "x@x.rr");

    var response = transaction.Send().Result;

    if (response.IsSuccessfull())
    {
        Console.WriteLine("Credit is ok. New transaction ID: " + response.transactionID);
    } 
    else
    {
        Console.WriteLine("Error performing credit: " + response.errorMessage);
    }

        

Response

The body of the response is in JSON format.

The following fields are present in the response :


Name Type Description
transactionID String Transaction reference returned by the system
errorCode String See API Response Codes
errorMessage String See API Response Codes

© Payzone | 2023