eWAYPayment / eway-rapid-php

Eway Rapid PHP library
https://www.eway.com.au
MIT License
14 stars 24 forks source link

TransactionType in createCustomer and updateCustomer #6

Closed marekfri closed 8 years ago

marekfri commented 8 years ago

Hi developers,

When account is not PCI certified and is using client-side encryption to encrypt credit card details, createCustomer and updateCustomer functions are failing with error no. V6010 - Invalid TransactionType, account not certified for eCome only MOTO or Recurring available.

I would suggest to change the TransactionType value in both mentioned methods to MOTO as it would be suitable for all the use cases.

Kind regards, Marek

incarnate commented 8 years ago

Hi Marek,

That's interesting - you shouldn't be getting that error unless you aren't encrypting the card or the TransactionType is missing. Is this something you get on Sandbox, or only on production?

marekfri commented 8 years ago

Hi incarnate,

well at the moment I get this only on Sandbox as I won't switch to live gateway before all is working well and with no issues. I'm encrypting credit card number and it is accepted from the API. There is just a problem with Purchase transaction type. If I change this to MOTO, all is working well.

incarnate commented 8 years ago

Hi Marek,

Thanks for the feedback. This is a quick sample code that I've used to test successfully, is it very different from what you are doing?

// Create the eWAY Client
$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$customer = [
     'Title' => 'Mr.',
     'FirstName' => 'John',
     'LastName' => 'Smith',
     'Country' => 'au',
     'CardDetails' => [
         'Name' => 'John Smith',
         'Number' => 'eCrypted:U6aX6gTRB17e...',
         'ExpiryMonth' => '12',
         'ExpiryYear' => '25',
         'CVN' => 'eCrypted:U6aX6gTR...',
     ]
 ];

$response = $client->createCustomer(\Eway\Rapid\Enum\ApiMethod::DIRECT, $customer);

var_dump($response->Customer->TokenCustomerID);
marekfri commented 8 years ago

No, it's basically the same. I just don't send CVN attribute - only Name, encrypted Number, Expiry month and year. May this problem occur if such case?

incarnate commented 8 years ago

Thanks Marek, leaving the CVN out does throw that error.

I've just updated the SDK to version 1.2.1 with a fix for this issue, thanks for your patience. Let us know if it works for you!

marekfri commented 8 years ago

I've tested the new version and everything works well now.

Thank you.

incarnate commented 8 years ago

Great to hear, thanks for your help Marek!

vistarainfo commented 8 years ago

Hello How can I use client side encryption in create customer Can you give me example?

incarnate commented 8 years ago

Hi Kiran, Client Side Encryption happens on the customer's browser, so you'll need to use the eWAY eCrypt Javascript to encrypt the data in your payment form. You can find examples of implementing the encryption in the Rapid API reference.

The encrypted card and CVN get sent in the Number and CVN fields using Direct Connection.

$customer = [
    'Title' => 'Mr.',
    'FirstName' => 'John',
    'LastName' => 'Smith',
    'Country' => 'au',
    'CardDetails' => [
            'Name' => 'John Smith',
            'Number' => 'eCrypted:U4joC6nXmoYrqos8oiJ7PyGLtUYmTIW4SwiYoXw8kGvhQjM0cJgah/VKckw4I99N3ocG5/ve3oqoUjB4B/E8K3c1GI3j0irxbw5MB etc',
            'ExpiryMonth' => '12',
            'ExpiryYear' => '25',
            'CVN' => 'eCrypted:FerALqBR/8w3/OngyR+LmowtUakb+9GfbQ7wJvbpoxdbpnO2lP5bncu8SnVOENeOUu9D3+8E+oRkiWxj6sLBYy3HgjeRQmxaf1MmHQ950BBkvz24G2p6hsWQDABJkvGwyouBjBWqYqzvLRoYd51eKXuWGzZ1g5U543RKCfkXh5 etc',
    ]
];

$response = $client->createCustomer(\Eway\Rapid\Enum\ApiMethod::DIRECT, $customer);

If you need any further help, feel free to jump on chat with our friendly customer care team!