This is how I work right now to build up membership on the website via paypal.
I would like to get done like that here:
"plan": {
"id": "P-rtfhfedh",
"state": "ACTIVE",
"name": "T-Shirt of the Month Club Plan",
"description": "Template creation.",
"type": "FIXED",
"payment_definitions": [
{
"id": "PD-50606817NF8063316RWBZEUA",
"name": "Regular Payments",
"type": "REGULAR",
"frequency": "Month",
"amount": {
"currency": "USD",
"value": "100"
}
}
]
What I have done than to now in my MVC site it is like this:
int orderid = Convert.ToInt32(HelperClass.Helper.Settings.NyTal(8));
JsonPaypal jsonpaypal = new JsonPaypal();
jsonpaypal.IdValue = id + orderid;
jsonpaypal.Name = "Medlemskab";
jsonpaypal.description = "Medlemskab - Orderid: " + orderid;
jsonpaypal.start_date = DateTime.Now;
jsonpaypal.Plan = new string[] {
"id:" Convert.ToString(id + orderid),
"State": "ACTIVE",
};
Class to JsonPaypal
public class JsonPaypal
{
public int IdValue
{
get; set;
}
public string Name
{
get; set;
}
public string description
{
get; set;
}
public DateTime start_date
{
get; set;
}
public string payerURL
{
get; set;
}
public string Plan
{
get; set;
}
public string URL
{
get; set;
}
public string Obj
{
get; set;
}
}
The problem is when I go into my plan and make multiple object which will also be shown from the code paypal made.
The fault lies as said by Plan.
You need to set your
public string Plan { get; set; }
object to be astring[]
string array.Like this:
public string[] Plan { get; set; }
This is why you are getting this red squiggly, as your code is trying to set a normal
string
to an array ofstring
s.Hope this helps!
EDIT Also, after more looking, I realised you are trying to add strings to your string array incorrectly.
Syntax for adding strings is like this:
Where you are creating your strings, and using other properties/variables to create them, ensure you are creating the string itself correctly. Close off your string and add
+
to append strings from methods or properties. Likewise, to add to a string from a method or property, add+ " extra string stuff"
.Like this
Your code where setting
jsonpaypal.Plan
should be...Hope this helps!