public void Test() { PaymentsApi.PublicApiKey = "sbpb_MDllNDA0OTctZWFkYS00YjU4LThjNjQtNzlkOWRkNmYyOTdl"; PaymentsApi.PrivateApiKey = "0mGscVpVCqrGTNQD/yIYRei75eyUxPr+CRqv7ce9Zzx5YFFQL0ODSXAOkNtXTToq"; PaymentsApi api = new PaymentsApi(); CardToken cardToken = new CardToken(); Card card = new Card(); card.Cvc = "123"; card.ExpMonth = 11; card.ExpYear = 19; card.Number = "5105105105105100"; Customer customer = new Customer(); customer.Card = card; customer.Email = "*****@*****.**"; customer.Name = "Customer Customer"; customer.Reference = "Ref1"; customer = (Customer)api.Create(customer); Payment payment = new Payment(); payment.Amount = 1000; payment.Currency = "USD"; payment.Description = "payment description"; payment.Reference = "7a6ef6be31"; payment.Customer = customer; payment = (Payment)api.Create(payment); }
public SimplifyCommerceService() { _api = new PaymentsApi(); PaymentsApi.PublicApiKey = "sbpb_MDllNDA0OTctZWFkYS00YjU4LThjNjQtNzlkOWRkNmYyOTdl"; PaymentsApi.PrivateApiKey = "0mGscVpVCqrGTNQD/yIYRei75eyUxPr+CRqv7ce9Zzx5YFFQL0ODSXAOkNtXTToq"; }
private bool MakeSimplifyPaymentRequest(ClientPaymentInformation clientPayment) { PaymentsApi api = new PaymentsApi(); Card card = new Card() { Cvc = "123", ExpMonth = clientPayment.ExpirationMonth, ExpYear = clientPayment.ExpirationYear, Number = clientPayment.CardNumber, }; Payment payment = new Payment() { Card = card, Currency = "USD", Description = clientPayment.Description + " Ödeme yapıldı.", Amount = clientPayment.Amount, }; try { payment = (Payment)api.Create(payment); } catch (Exception ex) { throw ex; } return true; }
public Task<Data.Entities.Tickets.Tickets> BuyTicketWithToken(string token, Data.Entities.Events.Events buyEvent, User userBuying) { PaymentsApi.PublicApiKey = "sbpb_MzlkM2M1MjItZDkwZi00NTY5LWI1YzAtOGFiM2Y5YWJlMzQx"; PaymentsApi.PrivateApiKey = Environment.GetEnvironmentVariable("SimplifyPrivate"); var api = new PaymentsApi(); var customer = new Customer { Token = token, Name = userBuying.Name, Reference = "Locality Customer", Email = "*****@*****.**" }; try { customer = (Customer) api.Create(customer); var payment = new Payment { Amount = (long)buyEvent.Price * 100, Currency = "GBP", Description = $"Ticket for {buyEvent.Name}", Customer = customer }; payment = (Payment)api.Create(payment); return Task.FromResult(new Data.Entities.Tickets.Tickets { Id = Guid.NewGuid(), Barcode = payment.Reference, EventId = buyEvent.Id, UserId = userBuying.Id, Used = false, CustomerId = customer.Id }); } catch { return null; } }
public Task<Data.Entities.Tickets.Tickets> BuyTicketWithCustomer(Data.Entities.Events.Events buyEvent, User userBuying) { PaymentsApi.PublicApiKey = "sbpb_MzlkM2M1MjItZDkwZi00NTY5LWI1YzAtOGFiM2Y5YWJlMzQx"; PaymentsApi.PrivateApiKey = Environment.GetEnvironmentVariable("SimplifyPrivate"); var api = new PaymentsApi(); try { var customer = (Customer) api.Find(typeof (Customer), userBuying.CustomerId); if (customer == null) { return null; } var payment = new Payment { Amount = (long)buyEvent.Price * 100, Currency = "GBP", Description = $"Ticket for {buyEvent.Name}", Customer = customer }; payment = (Payment)api.Create(payment); return Task.FromResult(new Data.Entities.Tickets.Tickets { Id = Guid.NewGuid(), Barcode = payment.Reference, EventId = buyEvent.Id, UserId = userBuying.Id, Used = false }); return null; } catch { return null; } }