public async void Example() { #pragma warning disable 0168 using (Client client = GetClient()) { PayoutResponse response = await client.Merchant("merchantId").Payouts().Get("payoutId"); } #pragma warning restore 0168 }
public void PayoutSuccessTest() { Client client = CreateMockTestClientNullRequiredFieldsRequest("Mocks/payout/payout-success.json"); Payout payout = new Payout(client); PayoutRequest request = new PayoutRequest(); PayoutResponse result = payout.PayoutSubmit(request); Assert.AreEqual("8814689190961342", result.PspReference); Assert.AreEqual("12345", result.AuthCode); }
public async void Example() { #pragma warning disable 0168 using (Client client = GetClient()) { ApprovePayoutRequest body = new ApprovePayoutRequest(); body.DatePayout = "20150102"; PayoutResponse response = await client.Merchant("merchantId").Payouts().Approve("payoutId", body); } #pragma warning restore 0168 }
private async Task ShouldRequestPayout_IdempotencyKey() { var payoutRequest = new PayoutRequest(); var payoutResponse = new PayoutResponse(); _apiClient.Setup(apiClient => apiClient.Post <PayoutResponse>(PaymentsPath, _authorization, payoutRequest, CancellationToken.None, "test")) .ReturnsAsync(() => payoutResponse); IPaymentsClient paymentsClient = new PaymentsClient(_apiClient.Object, _configuration.Object); var response = await paymentsClient.RequestPayout(payoutRequest, "test", CancellationToken.None); response.ShouldNotBeNull(); response.ShouldBeSameAs(payoutResponse); }
//Transfer an amount to an existing Bank Account Set up with Stripe public PayoutResponse TransferToBankAccount(decimal amount, string currency) { //Stripe requires amount in cents var transferAmount = ((int)amount * 100); HttpContent content = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("amount", transferAmount.ToString()), new KeyValuePair <string, string>("currency", currency) }); content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded"); HttpResponseMessage response = (_client.PostAsync($"https://api.stripe.com/v1/payouts", content)) .GetAwaiter().GetResult(); var payoutResponse = new PayoutResponse(); if (response.IsSuccessStatusCode) { payoutResponse = JsonConvert.DeserializeObject <PayoutResponse>(response.Content.ReadAsStringAsync().Result); } return(payoutResponse); }
private async Task ShouldRequestPayout() { var payoutRequest = new PayoutRequest { Destination = new PaymentRequestBankAccountDestination { AccountType = AccountType.Cash, AccountNumber = "13654567455", BankCode = "bank_code", BranchCode = "6443", Bban = "3704 0044 0532 0130 00", Iban = "HU93116000060000000012345676", SwiftBic = "37040044", Country = CountryCode.HU, AccountHolder = new AccountHolder { FirstName = "First Name", LastName = "Last Name", }, Bank = new BankDetails { Name = "Bank Name", Address = new Address(), Branch = "branch" } } }; var payoutResponse = new PayoutResponse(); _apiClient.Setup(apiClient => apiClient.Post <PayoutResponse>(PaymentsPath, _authorization, payoutRequest, CancellationToken.None, null)) .ReturnsAsync(() => payoutResponse); IPaymentsClient paymentsClient = new PaymentsClient(_apiClient.Object, _configuration.Object); var response = await paymentsClient.RequestPayout(payoutRequest, null, CancellationToken.None); response.ShouldNotBeNull(); response.ShouldBeSameAs(payoutResponse); }
public async void Example() { #pragma warning disable 0168 using (Client client = GetClient()) { AmountOfMoney amountOfMoney = new AmountOfMoney(); amountOfMoney.Amount = 2345L; amountOfMoney.CurrencyCode = "EUR"; BankAccountIban bankAccountIban = new BankAccountIban(); bankAccountIban.AccountHolderName = "Wile E. Coyote"; bankAccountIban.Iban = "IT60X0542811101000000123456"; Address address = new Address(); address.City = "Burbank"; address.CountryCode = "US"; address.HouseNumber = "411"; address.State = "California"; address.Street = "N Hollywood Way"; address.Zip = "91505"; CompanyInformation companyInformation = new CompanyInformation(); companyInformation.Name = "Acme Labs"; ContactDetailsBase contactDetails = new ContactDetailsBase(); contactDetails.EmailAddress = "*****@*****.**"; PersonalName name = new PersonalName(); name.FirstName = "Wile"; name.Surname = "Coyote"; name.SurnamePrefix = "E."; name.Title = "Mr."; PayoutCustomer customer = new PayoutCustomer(); customer.Address = address; customer.CompanyInformation = companyInformation; customer.ContactDetails = contactDetails; customer.Name = name; BankTransferPayoutMethodSpecificInput bankTransferPayoutMethodSpecificInput = new BankTransferPayoutMethodSpecificInput(); bankTransferPayoutMethodSpecificInput.BankAccountIban = bankAccountIban; bankTransferPayoutMethodSpecificInput.Customer = customer; bankTransferPayoutMethodSpecificInput.PayoutDate = "20150102"; bankTransferPayoutMethodSpecificInput.PayoutText = "Payout Acme"; bankTransferPayoutMethodSpecificInput.SwiftCode = "swift"; PayoutReferences references = new PayoutReferences(); references.MerchantReference = "AcmeOrder001"; CreatePayoutRequest body = new CreatePayoutRequest(); body.AmountOfMoney = amountOfMoney; body.BankTransferPayoutMethodSpecificInput = bankTransferPayoutMethodSpecificInput; body.References = references; try { PayoutResponse response = await client.Merchant("merchantId").Payouts().Create(body); } catch (DeclinedPayoutException e) { HandleDeclinedPayout(e.PayoutResult); } catch (ApiException e) { HandleApiErrors(e.Errors); } } #pragma warning restore 0168 }
private async Task ShouldMakeCardPayoutPayments() { PayoutRequest request = new PayoutRequest { Source = new PayoutRequestCurrencyAccountSource { Id = "ca_qcc7x4nxxk6efeogm7yczdnsxu" }, Destination = new PaymentRequestCardDestination { Number = "5219565036325411", ExpiryMonth = 12, ExpiryYear = 2024, AccountHolder = new AccountHolder { Type = AccountHolderType.Individual, FirstName = "Jhon", LastName = "Smith", DateOfBirth = "1939-05-05", CountryOfBirth = CountryCode.FR, BillingAddress = new Address { AddressLine1 = "Checkout", AddressLine2 = "Shepherdless Walk", City = "London", Zip = "N17BQ", Country = CountryCode.GB }, Phone = new Phone { CountryCode = "44", Number = "09876512412" }, Identification = new AccountHolderIdentification { Type = AccountHolderIdentificationType.Passport, Number = "E2341", IssuingCountry = CountryCode.FR, DateOfExpiry = "2024-05-05" }, Email = "*****@*****.**" } }, Amount = 10, Currency = Currency.EUR, Reference = "Pay-out to Card - Money Transfer", BillingDescriptor = new PayoutBillingDescriptor { Reference = "Pay-out to Card - Money Transfer" }, Sender = new PaymentIndividualSender { FirstName = "Hayley", LastName = "Jones", Address = new Address { AddressLine1 = "Checkout", AddressLine2 = "Shepherdless Walk", City = "London", Zip = "N17BQ", Country = CountryCode.GB }, Reference = "1234567ABCDEFG", ReferenceType = "other", DateOfBirth = "1939-05-05", SourceOfFunds = SourceOfFunds.Credit, }, Instruction = new PaymentInstruction { Purpose = "pension", FundsTransferType = "C07", Mvv = "0123456789" }, ProcessingChannelId = "pc_q727c4x6vtwujbiys3bb7wjpaa" }; PayoutResponse response = await DefaultApi.PaymentsClient().RequestPayout(request); response.ShouldNotBeNull(); response.Id.ShouldNotBeNull(); response.Status.ShouldNotBeNull(); response.Instruction.ShouldNotBeNull(); response.Instruction.ValueDate.ShouldNotBeNull(); }