I am creating a stub service of my own for testing, and trying to define a request DTO for the POST /subscriptions endpoint (that I use to create a stripe subscription from a list of Stripe Plans).
The raw HTTP request on the wire looks like this:
POST https://localhost.dev:4456/subscriptions HTTP/1.1
Authorization: Bearer sk_test_blahblahblah
Stripe-Version: 2018-02-06
User-Agent: Stripe/v1 .NetBindings/16.1.0
X-Stripe-Client-User-Agent: {"bindings_version":"16.1.0","lang":".net","publisher":"stripe","lang_version":".NET Framework 4.5+","os_version":"Microsoft Windows NT 10.0.17134.0"}
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Host: localhost.dev:4456
Content-Length: 177
Expect: 100-continue
items[0][plan]=aplanid&items[1][plan]=aplanid2&items[2][plan]=aplanid3&customer=acustomerid
We don’t have native support for the complex types Stripe expects on the URL/form-data. In each case this is needed we have to add [IgnoreDataMember] on the collection properties to skip the default serialization and customize how the URL is generated by implementing IUrlFilter.ToUrl() method to append the complex collection properties to the URL in the format Stripe expects. Here’s an example of implementing Stripe’s POST /products/{Id} UpdateStripeProduct API:
I am creating a web service that emulates the stripe API, so I have to define a request DTO for the POST /subcriptions endpoint that will deserialize the HTTP request above.
However, I cannot figure out how to handle the bazaar POSTed form data: