Billhighway Cloud API

<back to all web services

DonationCreditCardRequest

The following routes are available for this service:
POST/donations/creditcard
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DonationRecurringInfo:
    # @ApiMember(Description="How often donation is collected automatically", IsRequired=true, Name="Frequency")
    frequency: Optional[str] = None
    """
    How often donation is collected automatically
    """


    # @ApiMember(Description="Number of recurring donation cycles.", IsRequired=true, Name="NumberOfOccurrences")
    number_of_occurrences: int = 0
    """
    Number of recurring donation cycles.
    """


    # @ApiMember(Description="Allows the submitter to set a future date for the donation", Name="FutureDonationDate")
    future_donation_date: Optional[datetime.datetime] = None
    """
    Allows the submitter to set a future date for the donation
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class JsonObject(Dict[str,str]):
    pass


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DonationRequestBase:
    # @ApiMember(Description="Client value for Group. String must already be configured in Billhighway system.", IsRequired=true, Name="GroupID")
    group_id: Optional[str] = None
    """
    Client value for Group. String must already be configured in Billhighway system.
    """


    # @ApiMember(Description="Amount of the payment. Must be an amount less than $10,000,000.00.", IsRequired=true, Name="Amount")
    amount: Decimal = decimal.Decimal(0)
    """
    Amount of the payment. Must be an amount less than $10,000,000.00.
    """


    # @ApiMember(Description="The currency the payment is being made in. Three digit currency code (see ISO 4217) for a valid currency supported by Billhighway.  Defaults to USD", ExcludeInSchema=true, Name="CurrencyCode")
    currency_code: Optional[str] = None
    """
    The currency the payment is being made in. Three digit currency code (see ISO 4217) for a valid currency supported by Billhighway.  Defaults to USD
    """


    # @ApiMember(Description="Notes about the donation. Maximum 70 characters.", Name="Memo")
    memo: Optional[str] = None
    """
    Notes about the donation. Maximum 70 characters.
    """


    # @ApiMember()
    donation_recurring_info: Optional[DonationRecurringInfo] = None

    # @ApiMember(Description="Custom fields", Name="MetaData")
    meta_data: Optional[JsonObject] = None
    """
    Custom fields
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DonationCreditCardResponse(IHaveErrorField):
    # @ApiMember(Description="Legacy ErrorCode", ExcludeInSchema=true)
    # @Ignore()
    error_code: Optional[int] = None
    """
    Legacy ErrorCode
    """


    error_message: Optional[str] = None
    is_error: Optional[bool] = None
    # @ApiMember(Description="Donation Transaction ID")
    transaction_id: Optional[str] = None
    """
    Donation Transaction ID
    """


    card_ref: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DonationDonorInfo:
    # @ApiMember(Description="Name of donor. Maximum 100 characters. Format must be Firstname {space} Lastname.", IsRequired=true, Name="FullName")
    full_name: Optional[str] = None
    """
    Name of donor. Maximum 100 characters. Format must be Firstname {space} Lastname.
    """


    # @ApiMember(Description="Billing address. Maximum 100 characters.", IsRequired=true, Name="Address")
    address: Optional[str] = None
    """
    Billing address. Maximum 100 characters.
    """


    # @ApiMember(Description="Billing city. Maximum 100 characters.", IsRequired=true, Name="City")
    city: Optional[str] = None
    """
    Billing city. Maximum 100 characters.
    """


    # @ApiMember(Description="Billing state. Two characters, must match valid US state code.", IsRequired=true, Name="State")
    state: Optional[str] = None
    """
    Billing state. Two characters, must match valid US state code.
    """


    # @ApiMember(Description="Credit Card billing address postal code. Maximum 10 characters.", IsRequired=true, Name="PostalCode")
    postal_code: Optional[str] = None
    """
    Credit Card billing address postal code. Maximum 10 characters.
    """


    # @ApiMember(Description="Email address of donor. Maximum 100 characters. If provided, must be valid email format.", Name="EmailAddress")
    email_address: Optional[str] = None
    """
    Email address of donor. Maximum 100 characters. If provided, must be valid email format.
    """


    # @ApiMember(Description="Preferred phone number. Maximum 12 characters.", Name="Phone")
    phone: Optional[str] = None
    """
    Preferred phone number. Maximum 12 characters.
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DonationMemberInfo:
    # @ApiMember(IsRequired=true)
    bh_user_id: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DonationCreditCardRequest(DonationRequestBase, IDonationRequestWithDonorInfo):
    # @ApiMember(Description="Not required if MemberInfo is present on request")
    donor_info: Optional[DonationDonorInfo] = None
    """
    Not required if MemberInfo is present on request
    """


    # @ApiMember(Description="Not required if DonorInfo is present on request")
    member_info: Optional[DonationMemberInfo] = None
    """
    Not required if DonorInfo is present on request
    """


    # @ApiMember(Description="Campaign to track donation against and to define fund allocation. Use GET /campaigns to retreive valid list of campaignIDs")
    campaign_id: Optional[int] = None
    """
    Campaign to track donation against and to define fund allocation. Use GET /campaigns to retreive valid list of campaignIDs
    """


    # @ApiMember(Description="CardRef returned from client-side tokenization.  Also handles raw card number if your servers are PCI-DSS-compliant, and in that case this must be a valid card number for the CardType indicated.", IsRequired=true, Name="CardReferenceOrCardNumber")
    card_reference_or_card_number: Optional[str] = None
    """
    CardRef returned from client-side tokenization.  Also handles raw card number if your servers are PCI-DSS-compliant, and in that case this must be a valid card number for the CardType indicated.
    """


    card_type: Optional[str] = None
    # @ApiMember(Description="Credit Card Validation value. If Visa, Master Card or Discover, must be 3 digits. If AmEx, must be 4 digits.", Name="Cvv")
    cvv: Optional[str] = None
    """
    Credit Card Validation value. If Visa, Master Card or Discover, must be 3 digits. If AmEx, must be 4 digits.
    """


    # @ApiMember(IsRequired=true)
    # @ApiMember(Description="Credit Card expiration month. Valid Values 1-12.", IsRequired=true, Name="ExpirationMonth")
    expiration_month: int = 0

    # @ApiMember(Description="Credit Card expiration year. Four-digit Year. Value cannot be less than current year or more than 20 years in the future. ExpMonth + ExpYear must not be in the past.", IsRequired=true, Name="ExpirationYear")
    expiration_year: int = 0
    """
    Credit Card expiration year. Four-digit Year. Value cannot be less than current year or more than 20 years in the future. ExpMonth + ExpYear must not be in the past.
    """

Python DonationCreditCardRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /donations/creditcard HTTP/1.1 
Host: devapi.billhighway.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<DonationCreditCardRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BH.CloudAPI.Common4.DTO.Donations">
  <Amount>0</Amount>
  <CurrencyCode>String</CurrencyCode>
  <DonationRecurringInfo>
    <Frequency>String</Frequency>
    <FutureDonationDate>0001-01-01T00:00:00</FutureDonationDate>
    <NumberOfOccurrences>0</NumberOfOccurrences>
  </DonationRecurringInfo>
  <GroupId>String</GroupId>
  <Memo>String</Memo>
  <MetaData xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringstring>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value>String</d2p1:Value>
    </d2p1:KeyValueOfstringstring>
  </MetaData>
  <CampaignId>0</CampaignId>
  <CardReferenceOrCardNumber>String</CardReferenceOrCardNumber>
  <CardType>String</CardType>
  <Cvv>String</Cvv>
  <DonorInfo>
    <Address>String</Address>
    <City>String</City>
    <EmailAddress>String</EmailAddress>
    <FullName>String</FullName>
    <Phone>String</Phone>
    <PostalCode>String</PostalCode>
    <State>String</State>
  </DonorInfo>
  <ExpirationMonth>0</ExpirationMonth>
  <ExpirationYear>0</ExpirationYear>
  <MemberInfo>
    <BhUserId>0</BhUserId>
  </MemberInfo>
</DonationCreditCardRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<DonationCreditCardResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BH.CloudAPI.Common4.DTO.Donations">
  <CardRef>String</CardRef>
  <ErrorCode>0</ErrorCode>
  <ErrorMessage>String</ErrorMessage>
  <IsError>false</IsError>
  <TransactionId>String</TransactionId>
</DonationCreditCardResponse>