Can't add credit card to vault in web services

SOLVED

Hello!

We trying to use web services for our shopping cart on web site and now we are testing different calls provided by it.

We have no problems with orders and customers creation, but have problems with credit cards.

When we call AddCreditCardToVault we get:

"Could not add credit card to vault:"

And no additional details... When we add credit card via desktop version of MAS Sage 100 ERP - no problems.

Can you please help me? Maybe we need to activate some security or configuration setting?

Thanks a lot.

Dmitry

  • 0

    Here are a couple samples that may help you.

    ! -> Alternative 1 - Add new credit card to SPS Vault (Mirrors Web Services)

    ! -> pmtType$ [input, string] Payment Type

    ! -> cc$ [input, string] Credit Card Number to add

    ! -> yr$ [input, string] Credit Card Expiration Year (yyyy)

    ! -> mo$ [input, string] Credit Card Expiration Month (mm)

    ! -> guid$ [output, string] Credit Card GUID

    ! -> returns [boolean] True = success, False = failure

    oPmt'ARCreditCard'AddNewCreditCard( PaymentType$, \

    ccNo$, \

    ExpirationDateYear$, \

    ExpirationDateMonth$, \

    CreditCardGUID$)

    ! -> Alternative 2 - Add new credit card to SPS Vault, When successful, CreditCardGUID$, CreditCardID$, Last4UnencryptedCreditCardNos$, ExpirationDateYear$, ExpirationDateMonth$, CardType$ is set via SetPartialRecord();CreditCardID$ is set to a new unique value via GetNextCreditCardID(nextID$)

    ! -> pmtType$ [input, string] Payment Type

    ! -> cc$ [input, string] Credit Card Number to add

    ! -> yr$ [input, string] Credit Card Expiration Year (yyyy)

    ! -> mo$ [input, string] Credit Card Expiration Month (mm)

    ! -> fromEbmStore {optional} [input boolean] identifies when processing from .store / allows divNo$ and CustNo to be null when assigning the next CardID$

    ! -> [boolean] True = success, False = failure

    oPmt'AddNewCreditCard(PaymentType$, \

    ccNo$, \

    ExpirationDateYear$, \

    ExpirationDateMonth$)

    }

  • 0 in reply to mpjagosz

    AddCreditCardToVault

    Parameters

    logon

    Type: Logon

    The user name and password to be used for the operation

    companyCode

    Type: string

    The company from which to add the credit card data to the vault

    paymentType

    Type: string

    The payment type used for the credit card

    creditcardData

    Type: string

    The credit card number and expiration date formatted as follows:

    nnnnnnnnnnnnnnnn|mmyy

    Return Value

    Type: string

    A GUID that can be used in future calls to PreAuthorizeCreditCard

    eBusiness Web Services Installation and Reference Guide 47

    _____________________________________________________________________________________________

    PreAuthorizeCreditCard

    Remarks

    This operation adds a credit card number and expiration date to the Sage

    Exchange secure vault and returns a unique identifier that can be used in

    future calls to PreAuthorizeCreditCard and is also placed in the

    SalesOrder contract for various sales order operations.

    The following is an example of data that should be passed into the

    creditcardData parameter:

    4111111111111111|0616

    Note that the pipe character is used to separate the credit card number

    from the expiration date.

  • 0 in reply to mpjagosz

    Hello!

    Thanks for your response. Here is my code:

    ----

    <?php

     $logon = new stdClass();

     $logon->Username = "webservices";

     $logon->Password = "*******";

     $companyCode = "TST";

     $arDivisionNo = "00";

     $customerNo = "0000006";

     $paymentType = "V/MC";

     $creditcardData = "4111111111111111|0616";

     try {

       $client = new SoapClient("10.28.0.18/.../masbasicwsdl.svc);

       $response = $client->AddCreditCardToVault(array(

         "logon"=>$logon,

         "companyCode"=>$companyCode,

         "paymentType"=>$paymentType,

         "creditcardData"=>$creditcardData)

       );

       print_r($response);

     } catch (Exception $ex) {

       echo $ex->getMessage();

     }

    ?>

    ----

    And it return: "Could not add credit card to vault:"

    Am I doing something wrong?

    Thanks a lot.

    Dmitry

  • 0 in reply to Dmitry

    Regarding SPS vault, i never heard about it, do you have any manual or technical documentation for it? I don't know even WSDL link for it... Thanks.

  • 0 in reply to Dmitry

    I would make sure the paymentType field in the request matches the configured payment type in Sage100 where you have the Sage Vault credentials entered.

  • 0 in reply to Launch Gate

    On the Sage 100 ERP Applications DVD, inside the Documents folder you will find a WebServices.pdf.  At the end it has a good troubleshooting section, especially the "Downloading WSDL - Wrong Host Name" and "Setting SSL Host Headers", which are quite common.  Have you run through that?

  • 0 in reply to mpjagosz

    Hm, there was one error before, when only we started testing:

    Our web server is on one computer and managed with linux os, and MAS server is on other computer with windows os.

    So initially there was issue - when we download the WSDL schema on web server it was coming with local XSD links like local.computer.name/virtual directory/entry point   and it was fail because web server were not able to recognize what is local.computer.name.

    Then we did a small easy fix - we added in hosts file on web server a line that resolves local.computer.name to actual MAS server IP (like we fooled web server so he knows where that hostname is).

    And it all worked perfectly for all other calls - orders, customers etc.

    But not only to add credit card to vault.

    Could it be a reason?

    Also our MAS server is under firewall in LAN and its not accessible from outside world - maybe that is a problem too? Does sage exchange trying to talk back to it? But when we add card with desktop - it works...

    What do you think?

    Thanks.

  • 0 in reply to Dmitry

    You are using  the right method and  passing in the right things. We are assuming  the payment type is correct too.  Are you using any other methods with that payment type?  It must match the one set up in Sage 100.  Can you email the following information to me at [email protected].

    1) point your browser to Point a browser to https://<hostname>/<virtual directory>/<entry point>.

    For example:

    www.sage.com/.../masservice.svc and send results.

    Maybe there still is a problem in the SSL Host Header.

    2) On what system is your php script running?

    3) What version of Sage 100 are you running?

  • 0 in reply to mpjagosz
    verified answer

    One of our archetects did notice the following.  give this a try and let us know the results.

    "creditcardData"=>$creditcardData)

    It should be "creditCardData". Note the uppercase C.

  • 0 in reply to mpjagosz

    Thank Mitchell!!!!!!

    it worked! Just one letter changed and it work now!!!!!!!

    Btw in manual there is "creditcardData" - so probably many other people may see the same issue.

    Thank you very much for your help Mitchell!

    We are trying to create a custom shopping cart for client with combination of two tools: Web services and SDATA (to use for inventory retrieval etc)...

    Thanks again!