Offer oluşturmak için Subscreasy panelinden | Teklifler kısmına tıklayarak, +Yeni Teklif Oluştur seçeneğinden kolayca oluşturabilirsiniz. Bunun dışında API kullanarak offer oluşturabilmeniz için bazı parametreler ekleyerek Post request yapmanız gerekiyor:
Method: POST
Path: /api/offers
Sandbox Url: https://sandbox.subscreasy.com/api/offers
Bu servis, güvenlik açısından, API yetkilendirmesine gerek duyar. API yetkilendirmesi hakkında detay için tıklayınız.
Curl
curl --location --request POST 'https://sandbox.subscreasy.com/api/offers' \
--header 'Authorization: Apikey brs-1234567890' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "name3",
"description": "description",
"price": 100,
"currency": "TRY",
"openEnded": false,
"recurrenceCount": 2,
"trialPeriod": 15,
"recurrence": {
"recurrenceType": "MONTHLY",
"length": 12
},
"freemium": false,
"productType": "SERVICE",
"renewalType": "BILLCYCLE"
}'
C#
var client = new RestClient("https://sandbox.subscreasy.com/api/offers");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Apikey brs-1234567890");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"name\": \"name3\",\n \"description\": \"description\",\n \"price\": 100,\n \"currency\": \"TRY\",\n \"openEnded\": false,\n \"recurrenceCount\": 2,\n \"trialPeriod\": 15,\n \"recurrence\": {\n \"recurrenceType\": \"MONTHLY\",\n \"length\": 12\n },\n \"freemium\": false,\n \"productType\": \"SERVICE\",\n \"renewalType\": \"BILLCYCLE\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
JSON
{
"name": "name",
"description": "description",
"price": 100,
"currency": "TRY",
"openEnded": false,
"recurrenceCount": 2,
"trialPeriod": 15,
"recurrence": {
"recurrenceType": "MONTHLY",
"length": 12
},
"freemium": false,
"productType": "SERVICE",
"renewalType": "BILLCYCLE"
}
{
"company": {
"id": 1,
"name": "dtnbilim",
"siteName": "dtnbilim"
},
"id": 2,
"name": "name",
"description": "description",
"price": 1E+2,
"currency": "TRY",
"openEnded": false,
"multiplePurchase": false,
"recurrenceCount": 2,
"trialPeriod": 15,
"recurrence": {
"recurrenceType": "MONTHLY",
"length": 12
},
"productType": "SERVICE",
"renewalType": "BILLCYCLE",
"disablePaymentForm": false,
"createDate": "2021-06-19T11:32:29.525+03:00",
"physicalProduct": false,
"renewalBillcycleBased": true
}