0

I have created a sandbox test accounts for PayPal. I want to consume the PayPal api CreateInvoice,SendInvoice and CreateAndSendInvoice using SOAP xml format in C#. The documentation from x.com, doesn't show any completed request message at least in basic soap xml format, instead, it shows only the header part and definitions for soap xml tags.

Some examples are in JSON format but its not my preferred format,its light-weight but human readable. SDK's are using NVP format, although they have SOAP option but the codes are not able to compose the soap xml format for the payload.

I need the completed soap xml request message with at least the required fields to createinvoice.

I'm still searching stackoverflow so far.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
GiantHornet
  • 102
  • 8

1 Answers1

0

The API reference provides a graphical representation of the SOAP request. For example, you can take a look at CreateAndSendInvoice and see all of the tags that could be included in your XML/SOAP request as well as how everything should be nested.

If you're going to be building the XML yourself as oppose to using a WSDL there's really no need to format it for SOAP. Here's a sample of an XML Request for CreateInvoice that I just ran successfully...

<?xml version="1.0" encoding="utf-8"?>
<CreateInvoiceRequest xmlns="http://svcs.paypal.com/types/ap">
  <requestEnvelope xmlns="">
    <detailLevel>ReturnAll</detailLevel>
    <errorLanguage>en_US</errorLanguage>
  </requestEnvelope>
  <invoice xmlns="">
    <merchantEmail xmlns="">sandbo_1215254764_biz@angelleye.com</merchantEmail>
    <payerEmail xmlns="">sandbo_1204199080_biz@angelleye.com</payerEmail>
    <number xmlns="">12Z3-ABCDE</number>
    <merchantInfo xmlns="">
      <firstName xmlns="">Tester</firstName>
      <lastName xmlns="">Testerson</lastName>
      <businessName xmlns="">Testers, LLC</businessName>
      <phone xmlns="">555-555-5555</phone>
      <fax xmlns="">555-555-5556</fax>
      <website xmlns="">http://www.domain.com</website>
      <customValue xmlns="">Some custom info.</customValue>
      <address xmlns="">
        <line1 xmlns="">123 Main St.</line1>
        <city xmlns="">Grandview</city>
        <state xmlns="">MO</state>
        <postalCode xmlns="">64030</postalCode>
        <countryCode xmlns="">US</countryCode>
      </address>
    </merchantInfo>
    <itemList xmlns=""><item xmlns="">
      <name xmlns="">Test Widget 1</name>
      <description xmlns="">This is a test widget #1</description>
      <date xmlns="">2012-02-18</date>
      <quantity xmlns="">1</quantity>
      <unitPrice xmlns="">10.00</unitPrice>
      </item><item xmlns="">
      <name xmlns="">Test Widget 2</name>
      <description xmlns="">This is a test widget #2</description>
      <date xmlns="">2012-02-18</date>
      <quantity xmlns="">2</quantity>
      <unitPrice xmlns="">20.00</unitPrice>
      </item></itemList>
    <currencyCode xmlns="">USD</currencyCode>
    <paymentTerms xmlns="">DueOnReceipt</paymentTerms>
    <note xmlns="">This is a test invoice.</note>
    <merchantMemo xmlns="">This is a test invoice.</merchantMemo>
    <billingInfo xmlns="">
      <firstName xmlns="">Tester</firstName>
      <lastName xmlns="">Testerson</lastName>
      <businessName xmlns="">Testers, LLC</businessName>
      <phone xmlns="">555-555-5555</phone>
      <fax xmlns="">555-555-5556</fax>
      <website xmlns="">http://www.domain.com</website>
      <customValue xmlns="">Some custom info.</customValue>
      <address xmlns="">
        <line1 xmlns="">123 Main St.</line1>
        <city xmlns="">Grandview</city>
        <state xmlns="">MO</state>
        <postalCode xmlns="">64030</postalCode>
        <countryCode xmlns="">US</countryCode>
      </address>
    </billingInfo>
    <shippingInfo xmlns="">
      <firstName xmlns="">Tester</firstName>
      <lastName xmlns="">Testerson</lastName>
      <businessName xmlns="">Testers, LLC</businessName>
      <phone xmlns="">555-555-5555</phone>
      <fax xmlns="">555-555-5556</fax>
      <website xmlns="">http://www.domain.com</website>
      <customValue xmlns="">Some custom info.</customValue>
      <address xmlns="">
        <line1 xmlns="">123 Main St.</line1>
        <city xmlns="">Grandview</city>
        <state xmlns="">MO</state>
        <postalCode xmlns="">64030</postalCode>
        <countryCode xmlns="">US</countryCode>
      </address>
    </shippingInfo>
    <shippingAmount xmlns="">10.00</shippingAmount>
    <logoUrl xmlns="">https://www.usbswiper.com/images/angelley-clients/cpp-header-image.jpg</logoUrl>
    <referrerCode xmlns="">AngellEYE_PHPClass</referrerCode>
  </invoice>
</CreateInvoiceRequest>
Drew Angell
  • 25,968
  • 5
  • 32
  • 51