-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathAskCustomerCharge
More file actions
31 lines (22 loc) · 1.01 KB
/
AskCustomerCharge
File metadata and controls
31 lines (22 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
private string AskCustomerCharge(string shop, string token)
{
//create charged
var recurring = new Recurring();
recurring.Charge = new ChargeDetails
{
Name = "Fulfillment App Pro",
Price ="20.00",
ReturnUrl = string.Format("https://{0}/fulfillment/chargeresult?shop={1}", appUrl, shop),
TrialDays = "2",
Test = "true"
};
var chargeResultDetails = CreateCharged(token, shop, recurring);
if (chargeResultDetails.StatusCode == HttpStatusCode.Created)
{
ChargeResult chargeResult = JsonConvert.DeserializeObject<ChargeResult>(chargeResultDetails.Content);
//save to DB
//send to charge link for customer to accept or declined charge
return chargeResult.recurring_application_charge.confirmation_url;
}
return "";
}