{"id":196244,"date":"2013-10-03T15:31:03","date_gmt":"2013-10-03T11:31:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=196244"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=196244","title":{"rendered":"<span class=\"post_title\">\u041c\u043e\u0439 \u043e\u043f\u044b\u0442 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u0430 \u0441 BrainTree<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t<img decoding=\"async\" src=\"https:\/\/www.braintreepayments.com\/assets\/braintree.svg\" alt=\"image\"\/><br \/>  \u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0435 \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0435 \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043e\u043f\u043b\u0430\u0442\u044b <a href=\"https:\/\/www.braintreepayments.com\/\">BrainTree<\/a>. \u041f\u043e\u0438\u0441\u043a\u0430\u0432 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u0445 \u0441\u0430\u0439\u0442\u0430\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u0430\u043c\u043e\u043c\u0443. <a name=\"habracut\"><\/a><br \/>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u043a\u0440\u0430\u0442\u0446\u0435 \u043e BrainTree. \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u044b\u0445 \u043a\u0430\u0440\u0442. <br \/>  \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u044b\u0435 \u043f\u043b\u0430\u0442\u0435\u0436\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u043b\u0430\u0442\u0435\u0436\u0438 (\u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438).<br \/>  \u041d\u0430 \u0441\u0430\u0439\u0442\u0435 BrainTree \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b Developers. \u0422\u0430\u043c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u043e\u043f\u043b\u0430\u0442\u044b \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u0441\u0430\u0439\u0442\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:  <\/p>\n<ul>\n<li>Ruby <\/li>\n<li>Perl <\/li>\n<li>Python <\/li>\n<li>Java <\/li>\n<li>PHP <\/li>\n<li>Microsoft .NET <\/li>\n<li>Node JS <\/li>\n<\/ul>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0434\u043e\u0431\u043d\u0430\u044f \u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<h4>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c<\/h4>\n<p>  \u0414\u043b\u044f \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u043e\u043c\u0435\u0440\u0430 \u043a\u0430\u0440\u0442\u044b \u0438 CVV \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f JavaScript <a href=\"https:\/\/js.braintreegateway.com\/v1\/braintree.js\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/a>. \u0414\u0430\u043b\u0435\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0444\u043e\u0440\u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0432\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c BrainTree \u0434\u043b\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u0412 \u043e\u0442\u0432\u0435\u0442\u0435 BrainTree \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c: \u0432\u044b\u0434\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443, \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u0438 \u043f\u0440\u043e\u0447\u0435\u0435.<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/cda\/860\/a81\/cda860a81090d1050117ace56c742ebc.gif\" alt=\"image\"\/><br \/>  \u042f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 MVC 4. <br \/>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. (\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0412\u044b \u0443\u0436\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c, \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0442\u044f\u0436\u0435\u043b\u043e).<\/p>\n<h4>\u041e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u044b\u0435 \u043f\u043b\u0430\u0442\u0435\u0436\u0438<\/h4>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c BrainTree \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c <a href=\"https:\/\/www.braintreepayments.com\/assets\/client_libraries\/dotnet\/Braintree-2.25.4.dll\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <\/a> \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0451 \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443.<br \/>  \u0414\u0430\u043b\u0435\u0435 \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 BrainTree \u043f\u043e\u0434 \u0441\u0432\u043e\u0438\u043c \u043b\u043e\u0433\u0438\u043d\u043e\u043c \u0438 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0430\u0448\u0435\u0433\u043e \u044f\u0437\u044b\u043a\u0430 (\u0443 \u043d\u0430\u0441 .Net).<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/ff9\/022\/2c2\/ff90222c25e8c14c26e2ef09d9b6658c.png\" alt=\"image\"\/><\/p>\n<p>  \u0412\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e.  <\/p>\n<pre><code class=\"cs\">public static BraintreeGateway Gateway = new BraintreeGateway         {             Environment = Braintree.Environment.SANDBOX,             PublicKey = &quot;your_public_key&quot;,             PrivateKey = &quot;your_private_key&quot;,             MerchantId = &quot;your_merchant_id&quot;         }; <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 BrainTree.  <\/p>\n<pre><code class=\"cs\">using Braintree; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0443 \u0438 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0444\u043e\u0440\u043c\u0443.  <\/p>\n<pre><code class=\"html\">&lt;h1&gt;Braintree Credit Card Transaction Form&lt;\/h1&gt;     &lt;div&gt;       &lt;form action=&quot;@Url.Action(&quot;CreateTransaction&quot;)&quot; method=&quot;POST&quot; id=&quot;braintree-payment-form&quot;&gt;         &lt;p&gt;           &lt;label&gt;Card Number&lt;\/label&gt;           &lt;input type=&quot;text&quot; size=&quot;20&quot; autocomplete=&quot;off&quot; data-encrypted-name=&quot;number&quot; \/&gt;         &lt;\/p&gt;         &lt;p&gt;           &lt;label&gt;CVV&lt;\/label&gt;           &lt;input type=&quot;text&quot; size=&quot;4&quot; autocomplete=&quot;off&quot; data-encrypted-name=&quot;cvv&quot; \/&gt;         &lt;\/p&gt;         &lt;p&gt;           &lt;label&gt;Expiration (MM\/YYYY)&lt;\/label&gt;           &lt;input type=&quot;text&quot; size=&quot;2&quot; name=&quot;month&quot; \/&gt; \/ &lt;input type=&quot;text&quot; size=&quot;4&quot; name=&quot;year&quot; \/&gt;         &lt;\/p&gt;         &lt;input type=&quot;submit&quot; id=&quot;submit&quot; \/&gt;       &lt;\/form&gt;     &lt;\/div&gt; <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u043c\u0435\u0440 \u043a\u0430\u0440\u0442\u044b \u0438 cvv \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Braintree.js library. \u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432 \u043f\u0430\u043d\u0435\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f BrainTree.  <\/p>\n<pre><code class=\"html\">     &lt;script type=&quot;text\/javascript&quot; src=&quot;https:\/\/js.braintreegateway.com\/v1\/braintree.js&quot;&gt;&lt;\/script&gt;     &lt;script type=&quot;text\/javascript&quot;&gt;       var braintree = Braintree.create(&quot;YourClientSideEncryptionKey&quot;);       braintree.onSubmitEncryptForm('braintree-payment-form');     &lt;\/script&gt; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u044d\u0442\u0443 \u0444\u043e\u0440\u043c\u0443.  <\/p>\n<pre><code class=\"cs\">[HttpPost]     public ActionResult CreateTransaction(FormCollection collection)     {         TransactionRequest request = new TransactionRequest         {             Amount = 1000.0M, \/\/\u0417\u0434\u0435\u0441\u044c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0443\u043c\u043c\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0432 USD             CreditCard = new TransactionCreditCardRequest             {                 Number = collection[&quot;number&quot;],                 CVV = collection[&quot;cvv&quot;],                 ExpirationMonth = collection[&quot;month&quot;],                 ExpirationYear = collection[&quot;year&quot;]             },             Options = new TransactionOptionsRequest             {                 SubmitForSettlement = true             }         };          Result&lt;Transaction&gt; result = Gateway.Transaction.Sale(request);          if (result.IsSuccess())         {             Transaction transaction = result.Target;             ViewData[&quot;TransactionId&quot;] = transaction.Id;         }         else         {             ViewData[&quot;Message&quot;] = result.Message;         }          return View();     } <\/code><\/pre>\n<p>  \u0410 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438.  <\/p>\n<pre><code class=\"cs\">@if (ViewData.ContainsKey(&quot;TransactionId&quot;)) {     &lt;h2&gt;Success! Transaction ID: @ViewData[&quot;TransactionId&quot;]&lt;\/h2&gt; } else {     &lt;h2&gt;Error: @ViewData[&quot;Message&quot;]&lt;\/h2&gt; } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043d\u043e\u043c\u0435\u0440 \u043a\u0430\u0440\u0442\u044b \u00ab4111111111111111\u00bb \u0438 cvv \u00ab111\u00bb, \u0442.\u043a. \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0430\u0442\u044b \u043a\u0430\u0440\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0432\u0430\u043b\u0438\u0434\u043d\u0443\u044e \u0434\u0430\u0442\u0443. <\/p>\n<h4>\u041f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u043b\u0430\u0442\u0435\u0436\u0438<\/h4>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043b\u0430\u043d \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 (\u0430 \u043c\u043e\u0436\u0435\u0442 \u0438 \u043d\u0435 \u043e\u0434\u0438\u043d, \u0435\u0441\u043b\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a) \u0432 \u043f\u0430\u043d\u0435\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f BrainTree. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432 \u043b\u0435\u0432\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c Recurring Billing &gt; Plans. \u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u043b\u0430\u043d:<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/338\/970\/3c0\/3389703c0983680b289bf1fbf627c80f.png\" alt=\"image\"\/><br \/>  \u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u043c\u0443 \u043f\u0440\u043e\u0431\u043d\u044b\u0439 \u043f\u0435\u0440\u0438\u043e\u0434:<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/735\/d4c\/8e0\/735d4c8e032d444b827a5f67afd039ab.png\" alt=\"image\"\/><br \/>  \u0410 \u0442\u0430\u043a \u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0446\u0438\u043a\u043b\u0430 \u043e\u043f\u043b\u0430\u0442\u044b \u0438 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438:<img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/673\/5e5\/221\/6735e52215d73bfb9e58da20579ea96f.png\" alt=\"image\"\/><br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0443 \u0441 \u0444\u043e\u0440\u043c\u043e\u0439 \u0434\u043b\u044f \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043a\u0430\u0440\u0442\u0435 \u0438 \u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0435. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u043a\u0430\u0440\u0442\u044b \u0438 cvv \u043f\u0435\u0440\u0435\u0434 \u043e\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u0444\u043e\u0440\u043c\u044b.  <\/p>\n<pre><code class=\"html\">    &lt;h1&gt;Braintreegateway recurring billing&lt;\/h1&gt;     &lt;div id=&quot;braintreegateway-div-net&quot;&gt;                   &lt;h3&gt;Braintree Credit Card Transaction Form&lt;\/h3&gt;     &lt;div&gt;       &lt;form action=&quot;@Url.Action(&quot;CreateCustomer&quot;)&quot; method=&quot;POST&quot; id=&quot;braintree-payment-form1&quot;&gt;         &lt;p&gt;           &lt;label&gt;First name&lt;\/label&gt;           &lt;input type=&quot;text&quot; data-encrypted-name=&quot;first_name&quot; \/&gt;         &lt;\/p&gt;         &lt;p&gt;           &lt;label&gt;Last name&lt;\/label&gt;           &lt;input type=&quot;text&quot;  data-encrypted-name=&quot;last_name&quot; \/&gt;         &lt;\/p&gt;         &lt;p&gt;           &lt;label&gt;Postal code&lt;\/label&gt;           &lt;input type=&quot;text&quot;  data-encrypted-name=&quot;postal_code&quot; \/&gt;         &lt;\/p&gt;         &lt;p&gt;           &lt;label&gt;Card Number&lt;\/label&gt;           &lt;input type=&quot;text&quot; size=&quot;20&quot; autocomplete=&quot;off&quot; data-encrypted-name=&quot;number&quot; \/&gt;         &lt;\/p&gt;         &lt;p&gt;           &lt;label&gt;CVV&lt;\/label&gt;           &lt;input type=&quot;text&quot; size=&quot;4&quot; autocomplete=&quot;off&quot; data-encrypted-name=&quot;cvv&quot; \/&gt;         &lt;\/p&gt;           &lt;p&gt;               &lt;label&gt;Expiration (MM\/YYYY)&lt;\/label&gt;                              &lt;input type=&quot;text&quot; size=&quot;2&quot; name=&quot;month&quot;  \/&gt; \/ &lt;input type=&quot;text&quot; size=&quot;4&quot; name=&quot;year&quot; \/&gt;                          &lt;\/p&gt;           &lt;table&gt; &lt;\/table&gt;         &lt;input type=&quot;submit&quot; id=&quot;submit&quot; value=&quot;Create account&quot;\/&gt;       &lt;\/form&gt;     &lt;\/div&gt;     &lt;script type=&quot;text\/javascript&quot; src=&quot;https:\/\/js.braintreegateway.com\/v1\/braintree.js&quot;&gt;&lt;\/script&gt;     &lt;script type=&quot;text\/javascript&quot;&gt;         var braintree = Braintree.create(&quot;YourClientSideEncryptionKey&quot;);         braintree.onSubmitEncryptForm('braintree-payment-form1');     &lt;\/script&gt;     &lt;\/div&gt; <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0444\u043e\u0440\u043c\u044b:  <\/p>\n<pre><code class=\"cs\">[HttpPost] public ActionResult CreateCustomer(FormCollection collection) {     CustomerRequest request = new CustomerRequest     {         FirstName = collection[&quot;first_name&quot;],         LastName = collection[&quot;last_name&quot;],         CreditCard = new CreditCardRequest         {             BillingAddress = new CreditCardAddressRequest             {                 PostalCode = collection[&quot;postal_code&quot;]             },             Number = collection[&quot;number&quot;],             ExpirationMonth = collection[&quot;month&quot;],             ExpirationYear = collection[&quot;year&quot;],             CVV = collection[&quot;cvv&quot;]         }     };      Result&lt;Customer&gt; result = Constants.Gateway.Customer.Create(request);     if (result.IsSuccess())     {         Customer customer = result.Target;         ViewData[&quot;CustomerName&quot;] = customer.FirstName + &quot; &quot; + customer.LastName;         ViewData[&quot;CustomerId&quot;] = customer.Id;     }     else     {         ViewData[&quot;Message&quot;] = result.Message;     }      return View(); } <\/code><\/pre>\n<p>  \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0443 \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435, \u043b\u0438\u0431\u043e \u0441 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u00ab\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f\u00bb.  <\/p>\n<pre><code class=\"cs\">@if (ViewData.ContainsKey(&quot;CustomerId&quot;)) { &lt;h2&gt;Customer created with name: @ViewData[&quot;CustomerName&quot;]&lt;\/h2&gt; @Html.ActionLink(&quot;Click here to sign this Customer up for a recurring payment&quot;, &quot;CreateSubscription&quot;, &quot;Home&quot;, new { id = ViewData[&quot;CustomerId&quot;] }, null) } else { &lt;h2&gt;Error: @ViewData[&quot;Message&quot;]&lt;\/h2&gt; } <\/code><\/pre>\n<p>  \u0418 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438  <\/p>\n<pre><code class=\"cs\">public ActionResult CreateSubscription(string id)     {         try         {             Customer customer = Constants.Gateway.Customer.Find(id);             string paymentMethodToken = customer.CreditCards[0].Token;              SubscriptionRequest request = new SubscriptionRequest             {                 PaymentMethodToken = paymentMethodToken,                 PlanId = &quot;test_plan_1&quot;             };             Result&lt;Subscription&gt; result = Constants.Gateway.Subscription.Create(request);              return Content(&quot;Subscription Status &quot; + result.Target.Status);         }         catch (Braintree.Exceptions.NotFoundException e)         {             return Content(&quot;No customer found for id: &quot; + id);         }     } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0441\u043c\u043e\u0433\u0443\u0442 \u043f\u043b\u0430\u0442\u0438\u0442\u044c \u0437\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u043a \u0412\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0443.<\/p>\n<p>  \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0432\u0448\u0438\u043c\u0441\u044f \u043c\u043e\u0433\u0443 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0432\u0441\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0431\u043e\u0435\u0432\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043a\u0438\u0434\u043e\u043a, \u043d\u0430\u0446\u0435\u043d\u043a\u0438, \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u043f\u0440\u0435\u043b\u0435\u0441\u0442\u044f\u0445 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.   \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/196244\/\"> http:\/\/habrahabr.ru\/post\/196244\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t<img decoding=\"async\" src=\"https:\/\/www.braintreepayments.com\/assets\/braintree.svg\" alt=\"image\"\/><br \/>  \u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0435 \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0435 \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043e\u043f\u043b\u0430\u0442\u044b <a href=\"https:\/\/www.braintreepayments.com\/\">BrainTree<\/a>. \u041f\u043e\u0438\u0441\u043a\u0430\u0432 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u0445 \u0441\u0430\u0439\u0442\u0430\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u0430\u043c\u043e\u043c\u0443. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-196244","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/196244","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=196244"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/196244\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=196244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=196244"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=196244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}