Skip to content
Munir Wanis edited this page Feb 24, 2016 · 1 revision

Create Credit Card

require 'stone_ecommerce'

# variable with merchant key
merchantKey = '85328786-8BA6-420F-9948-5352F5A183EB'

# instantiate class with request methods
# :sandbox for sandbox ambient
# :production for production ambient
gateway = Gateway::Gateway.new(:sandbox, merchantKey)

create_instant_buy_data = Gateway::CreateInstantBuyDataRequest.new
create_instant_buy_data.BillingAddress.City = 'Tatooine'
create_instant_buy_data.BillingAddress.Complement = ''
create_instant_buy_data.BillingAddress.Country = 'Brazil'
create_instant_buy_data.BillingAddress.District = 'Mos Eisley'
create_instant_buy_data.BillingAddress.Number = '123'
create_instant_buy_data.BillingAddress.State = 'RJ'
create_instant_buy_data.BillingAddress.Street = 'Mos Eisley Cantina'
create_instant_buy_data.BillingAddress.ZipCode = '20001000'
create_instant_buy_data.CreditCardBrand = 'Visa'
create_instant_buy_data.CreditCardNumber = '4111111111111111'
create_instant_buy_data.ExpMonth = 10
create_instant_buy_data.ExpYear = 2022
create_instant_buy_data.HolderName = 'LUKE SKYWALKER'
create_instant_buy_data.IsOneDollarAuthEnabled = false
create_instant_buy_data.SecurityCode = '123'

response = gateway.CreateCreditCard(create_instant_buy_data)

puts response

Get Credit Card

require 'stone_ecommerce'

# variable with merchant key
merchantKey = '85328786-8BA6-420F-9948-5352F5A183EB'

# instantiate class with request methods
# :sandbox for sandbox ambient
# :production for production ambient
gateway = Gateway::Gateway.new(:sandbox, merchantKey)

# make the request and returns a response hash
response = gateway.GetCreditCard('3b3b5b62-6660-428d-905e-96f49d46ae28')

# prints the response
puts response

Get Credit Card with BuyerKey

require 'stone_ecommerce'

# variable with merchant key
merchantKey = '85328786-8BA6-420F-9948-5352F5A183EB'

# instantiate class with request methods
# :sandbox for sandbox ambient
# :production for production ambient
gateway = Gateway::Gateway.new(:sandbox, merchantKey)

# make the request and returns a response hash
response = gateway.GetCreditCardWithBuyerKey('247210dc-e02e-4c2c-9120-652e18aa8de8')

puts response

Update Credit Card

require 'stone_ecommerce'

# variable with merchant key
merchantKey = '85328786-8BA6-420F-9948-5352F5A183EB'

# instantiate class with request methods
# :sandbox for sandbox ambient
# :production for production ambient
gateway = Gateway::Gateway.new(:sandbox, merchantKey)

update_instant_buy_data_request = Gateway::UpdateInstantBuyDataRequest.new
update_instant_buy_data_request.BuyerKey = '247210dc-e02e-4c2c-9120-652e18aa8de8'

response = gateway.UpdateCreditCard('2723e9be-18cf-4cc2-bca1-63160efb6420', update_instant_buy_data_request)

puts response

Delete Credit Card

require 'stone_ecommerce'

# variable with merchant key
merchantKey = '85328786-8BA6-420F-9948-5352F5A183EB'

# instantiate class with request methods
# :sandbox for sandbox ambient
# :production for production ambient
gateway = Gateway::Gateway.new(:sandbox, merchantKey)

# Call delete method
response = gateway.DeleteCreditCard('07178e3e-00da-4445-959a-b2c6160b800e')

puts response