 			dataType: 'json'
 			data: JSON.stringify(checkoutRequest)
 
-	# Sends an orderForm attachment to the current OrderForm.
-	# @param attachmentId
-	# @param serializedAttachment stringified serializedAttachment
-	# @param expectedOrderFormSections
-	sendAttachment: (attachmentId, serializedAttachment, expectedOrderFormSections = @expectedFormSections, options = {}) =>
-		if attachmentId is undefined or serializedAttachment is undefined
+	# Sends an OrderForm attachment to the current OrderForm, possibly updating it.
+	# @param attachmentId [String] the name of the attachment you're sending.
+	# @param attachment [Object] the attachment.
+	# @param expectedOrderFormSections [Array] (default = *all*) an array of attachment names.
+	# @param options [Object] extra options.
+	# @option options [String] (default = null) subject an internal name to give to your attachment submission.
+	# @option options [Boolean] (default = false) abort indicates whether a previous submission with the same subject should be aborted, if it's ongoing.
+	# @return [Promise] a promise for the updated OrderForm.
+	sendAttachment: (attachmentId, attachment, expectedOrderFormSections = @allOrderFormSections, options = {}) =>
+		if attachmentId is undefined or attachment is undefined
 			d = $.Deferred()
 			d.reject("Invalid arguments")
 			return d.promise()
 
 		# TODO alterar chamadas para não mandar stringified
-		data = JSON.parse(serializedAttachment)
-		data[expectedOrderFormSections] = expectedOrderFormSections
+		attachment[expectedOrderFormSections] = expectedOrderFormSections
 
 		xhr = @ajax
 			url: @_getSaveAttachmentURL(attachmentId)
 			type: 'POST'
 			contentType: 'application/json; charset=utf-8'
 			dataType: 'json'
-			data: JSON.stringify(data)
+			data: JSON.stringify(attachment)
 
 		if options.abort and options.subject
 			@subjectToJqXHRMap[options.subject]?.abort()

		return undefined if cookie is undefined or cookie is ''
		return readSubcookie(cookie, COOKIE_ORDER_FORM_ID_KEY)

	_getOrderFormIdFromURL: =>
		urlParam('orderFormId')

	_getOrderFormURL: =>
		@HOST_ORDER_FORM_URL + @_getOrderFormId()

	_getSaveAttachmentURL: (attachmentId) =>
		@_getOrderFormURL() + '/attachments/' + attachmentId

	_getAddOfferingsURL: (itemIndex) =>
		@_getOrderFormURL() + '/items/' + itemIndex + '/offerings'

	_getRemoveOfferingsURL: (itemIndex, offeringId) =>
		@_getOrderFormURL() + '/items/' + itemIndex + '/offerings/' + offeringId + '/remove'

	_getAddCouponURL: =>
		@_getOrderFormURL() + '/coupons'

	_getOrdersURL: (orderGroupId) =>
		@HOST_URL + '/api/checkout/pub/orders/order-group/' + orderGroupId

	_startTransactionURL: =>
		@_getOrderFormURL() + '/transaction'

	_getUpdateItemURL: =>
		@_getOrderFormURL() + '/items/update/'

	_getPostalCodeURL: (postalCode = '', countryCode = 'BRA') =>
		@POSTALCODE_URL + countryCode + '/' + postalCode

	_getProfileURL: =>
		@HOST_URL + '/api/checkout/pub/profiles/'

# Compatibility with old clients - DEPRECATED!
window.vtex.checkout.API = CheckoutAPI


		return xhr

	# Sends a request to set the used locale.
	# @param locale [String] the locale string, e.g. "pt-BR", "en-US".
	# @return [Promise] a promise for the success.
	sendLocale: (locale='pt-BR') =>
		@sendAttachment('clientPreferencesData', {locale: locale}, [])

	# Sends a request to add an offering, along with its info, to the OrderForm.
	# @param offeringId [String, Number] the id of the offering.
	# @param offeringInfo
	# @param itemIndex [Number] the index of the item for which the offering applies.
	# @param expectedOrderFormSections [Array] (default = *all*) an array of attachment names.
	# @return [Promise] a promise for the updated OrderForm.
	addOfferingWithInfo: (offeringId, offeringInfo, itemIndex, expectedOrderFormSections = @allOrderFormSections) =>
		updateItemsRequest =
			id: offeringId
			info: offeringInfo
			expectedOrderFormSections: expectedOrderFormSections

		@ajax
			url: @_getAddOfferingsURL(itemIndex)
